Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: conditional syntax options

by mzedeler (Pilgrim)
on Jun 28, 2009 at 16:12 UTC ( #775476=note: print w/replies, xml ) Need Help??


in reply to conditional syntax options

If you want to check against a lot of constants, you can grep:

if(not grep {$string eq $_} qw{ X Y })

You can extend the list with X and Y as much as you like. Using it on two values only is overkill.

Replies are listed 'Best First'.
Re^2: conditional syntax options
by Albannach (Prior) on Jun 28, 2009 at 17:21 UTC
    That was my thought as well, but as citromatik points out, Perl 5.10's ~~ is a very good option, even better in fact!

    --
    I'd like to be able to assign to an luser

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://775476]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (6)
As of 2020-10-21 05:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My favourite web site is:












    Results (212 votes). Check out past polls.

    Notices?