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


in reply to Comparing against multiple values

PrimeLord's hash suggestion is quite good. I'd suggest also maybe a for loop as something more traditional:

for( qw( foo bar baz ) ){ print "yep" and last if $test eq $_; }
or all on one line:
print "yep" and last if $test eq $_ for( qw( foo bar baz ) );
if it'll be a more complex action down the line, you can "do":
do { print "yep"; last; } if $test eq $_ for( qw( foo bar baz ) );