Is there such a thing? The equivalent of a <= expr <= b
, or in SQL parlance expr BETWEEN a AND b
, where expr
is evaluated only once
In Perl6, the comparison operators are chainable.
http://perlcabal.org/syn/S03.html#Chained_comparisons:
Perl 6 supports the natural extension to the comparison operators, allowing multiple operands:
if 1 < $a < 100 { say "Good, you picked a number *between* 1 and 100." }
if 3 < $roll <= 6 { print "High roll" }
if 1 <= $roll1 == $roll2 <= 6 { print "Doubles!" }
In Perl 5, they are not.