@@ -604,6 +604,20 @@ the section L</"Operator Precedence and Associativity">.
604
604
Beware that they do not chain with equality operators, which have lower
605
605
precedence.
606
606
607
+ C<"lt">, C<"le">, C<"ge">, C<"gt">, and C<"cmp"> (this last is described
608
+ in the L<next section|/Equality Operators>) use the collation (sort)
609
+ order specified by the current C<LC_COLLATE> locale if a S<C<use
610
+ locale>> form that includes collation is in effect. See L<perllocale>.
611
+ Depending on the capabilities of the platform, these can give reasonable
612
+ results with Unicode, but the standard C<L<Unicode::Collate>> and
613
+ C<L<Unicode::Collate::Locale>> modules offer much more powerful
614
+ solutions to collation issues.
615
+
616
+ For case-insensitive comparisons, look at the L<perlfunc/fc> case-folding
617
+ function, available in Perl v5.16 or later:
618
+
619
+ if ( fc($x) eq fc($y) ) { ... }
620
+
607
621
=head2 Equality Operators
608
622
X<equality> X<equal> X<equals> X<operator, equality>
609
623
@@ -655,8 +669,10 @@ Here we can see the difference between <=> and cmp,
655
669
print 10 <=> 2 #prints 1
656
670
print 10 cmp 2 #prints -1
657
671
658
- (likewise between gt and >, lt and <, etc.)
659
672
X<cmp>
673
+ (likewise between the relational operators that were described in the
674
+ L<previous section|/Relational Operators>: gt and >, lt and
675
+ <, etc.)
660
676
661
677
Binary C<"~~"> does a smartmatch between its arguments. Smart matching
662
678
is described in the next section.
@@ -666,20 +682,6 @@ The two-sided ordering operators C<"E<lt>=E<gt>"> and C<"cmp">, and the
666
682
smartmatch operator C<"~~">, are non-associative with respect to each
667
683
other and with respect to the equality operators of the same precedence.
668
684
669
- C<"lt">, C<"le">, C<"ge">, C<"gt"> and C<"cmp"> use the collation (sort)
670
- order specified by the current C<LC_COLLATE> locale if a S<C<use
671
- locale>> form that includes collation is in effect. See L<perllocale>.
672
- Depending on the capabilities of the platform, these can give reasonable
673
- results with Unicode, but
674
- the standard C<L<Unicode::Collate>> and
675
- C<L<Unicode::Collate::Locale>> modules offer much more powerful
676
- solutions to collation issues.
677
-
678
- For case-insensitive comparisons, look at the L<perlfunc/fc> case-folding
679
- function, available in Perl v5.16 or later:
680
-
681
- if ( fc($x) eq fc($y) ) { ... }
682
-
683
685
=head2 Smartmatch Operator
684
686
685
687
First available in Perl 5.10.1 (the 5.10.0 version behaved differently),
0 commit comments