diff options
author | 積丹尼 Dan Jacobson <jidanni@jidanni.org> | 2021-05-22 12:24:43 +0800 |
---|---|---|
committer | Karl Williamson <khw@cpan.org> | 2021-05-31 07:47:21 -0600 |
commit | 047a0ea72f583771e88b81f628b4e3468b794b37 (patch) | |
tree | 0711ec93c7b3020fdf16d1cc78c8bf5779f5bd3d /pod | |
parent | 696d6093e71c6a7024d554e90a1e1efd28da51d2 (diff) | |
download | perl-047a0ea72f583771e88b81f628b4e3468b794b37.tar.gz |
Add difference between <=> and cmp example
For https://github.com/Perl/perl5/issues/18742
Diffstat (limited to 'pod')
-rw-r--r-- | pod/perlop.pod | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/pod/perlop.pod b/pod/perlop.pod index 91db8b8a98..f07c6bc6f1 100644 --- a/pod/perlop.pod +++ b/pod/perlop.pod @@ -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 |