Mega Code Archive

 
Categories / Perl / Language Basics
 

The numeric comparison operator evaluates its operands

#returning a -1 if the first operand is less than the second operand,  #             0 if the numbers are equal, or  #             1 if the first operand is greater than the second. $x = 5; $y = 4; $result = $x == $y; print "$result\n"; $result = $x != $y; print "$result\n"; $result = $x <=> $y; print "$result\n"; $result = $y <=> $x; print "$result\n";