Beefy Boxes and Bandwidth Generously Provided by pair Networks kudra
There's more than one way to do things
 
PerlMonks  

Re: Comparing against multiple values

by AidanLee (Chaplain)
on Mar 18, 2002 at 18:07 UTC ( [id://152605]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


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 ) );

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://152605]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.