Skip to content

Commit c2b2621

Browse files
committed
Move discussion of relational ops into proper section
These paragraphs were separated from the main area where all but one of their subjects, 'cmp', were discussed. Move them, and provide a link to the outlier, and back to the main discussion.
1 parent be6437f commit c2b2621

File tree

1 file changed

+17
-15
lines changed

1 file changed

+17
-15
lines changed

pod/perlop.pod

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -604,6 +604,20 @@ the section L</"Operator Precedence and Associativity">.
604604
Beware that they do not chain with equality operators, which have lower
605605
precedence.
606606

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+
607621
=head2 Equality Operators
608622
X<equality> X<equal> X<equals> X<operator, equality>
609623

@@ -655,8 +669,10 @@ Here we can see the difference between <=> and cmp,
655669
print 10 <=> 2 #prints 1
656670
print 10 cmp 2 #prints -1
657671

658-
(likewise between gt and >, lt and <, etc.)
659672
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.)
660676

661677
Binary C<"~~"> does a smartmatch between its arguments. Smart matching
662678
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
666682
smartmatch operator C<"~~">, are non-associative with respect to each
667683
other and with respect to the equality operators of the same precedence.
668684

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-
683685
=head2 Smartmatch Operator
684686

685687
First available in Perl 5.10.1 (the 5.10.0 version behaved differently),

0 commit comments

Comments
 (0)