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

Re: Need help testing to see if a variable is one value or the other

by Fletch (Chancellor)
on Jan 30, 2008 at 21:18 UTC ( #665221=note: print w/replies, xml ) Need Help??


in reply to Need help testing to see if a variable is one value or the other

Alternately (heh) use a regex.

if( $var =~ m/\A ( yes | no ) \z/x ) { print "you chose $1\n"; } else { print "BAD USER, NO DONUT!\n"; }

The cake is a lie.
The cake is a lie.
The cake is a lie.

  • Comment on Re: Need help testing to see if a variable is one value or the other
  • Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (7)
As of 2022-01-28 13:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:












    Results (73 votes). Check out past polls.

    Notices?