Skip to content

Commit

Permalink
Add difference between <=> and cmp example
Browse files Browse the repository at this point in the history
For #18742
  • Loading branch information
jidanni authored and khwilliamson committed May 31, 2021
1 parent 696d609 commit 047a0ea
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions pod/perlop.pod
Expand Up @@ -626,6 +626,13 @@ support C<"NaN">.)
Binary C<"cmp"> returns -1, 0, or 1 depending on whether the left
argument is stringwise less than, equal to, or greater than the right
argument.

Here we can see the difference between <=> and cmp,

print 10 <=> 2 #prints 1
print 10 cmp 2 #prints -1

(likewise between gt and >, lt and <, etc.)
X<cmp>

Binary C<"~~"> does a smartmatch between its arguments. Smart matching
Expand Down

0 comments on commit 047a0ea

Please sign in to comment.