http://www.perlmonks.org?node_id=152570


in reply to Re: Comparing against multiple values
in thread Comparing against multiple values

Maybe you want to score points for obfuscation:
if ({map{$_=>1}($bar,$baz,$boo)}->{$foo}) { print "Yes!\n"; }
A dirty, and almost as quick way is:
if (grep{$_ eq $foo} $bar, $baz, $boo) # ...
If you are comparing frequently, you might want to have a persistent hash which you can refer to on a regular basis. Why create it every time if it is the same?