... typically [hashes] are used..., but it's less elegant because I'd have to create the hash just for the comparison.
In all the pseudo or real solutions
if ($myfruit in ("bananas","apples","oranges")){ ... }
if ("bananas" ~~ ["bananas","apples","oranges"]) { ... }
if (grep { $myfruit eq $_ } qw(bananas apples oranges)){ ... }
a set must be created just for the comparison. (However, the match, smart-match and grep solutions allow matching for something other than equality.)
In reply to Re: IN-style operator for set of possible values
by AnomalousMonk
in thread IN-style operator for set of possible values
by BeneSphinx
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |