I had been using SQL long before discovering Perl and became quite fond of the SQL *IN* operator. Not having found the equivalent in Perl, I usually construct a hash with my values as the keys. Unless something similar has already been done (and I have not discovered it yet), would this be something worth petitioning the Perl gods for?
# What I want to do if ($value == 1 or $value == 5 or $value == 21 or $value == 99){... # How I often do it: my %list = (1 => 1, 5 => 1, 21 => 1, 99 => 1); if ($list{$value}){... # Wouldn't something like this be better? if ($value IN (1, 5, 21, 99)){...
UPDATE: Thanks everyone. It looks like Quantum::Superpositions does what I had in mind (didn't find it initially searching CPAN). Since I'm still trying to fill the holes in my *swiss cheese* knowledge of Perl 5, I haven't looked into Perl 6 much.
In reply to *IN* Operator for the Perl wish list by hangon
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |