Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

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

by traveler (Parson)
on Jan 30, 2008 at 22:36 UTC ( #665234=note: print w/ replies, xml ) Need Help??


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

Or, if GrandFather's solution is too elegant and simple, you can use a module. (It is way overkill here, though!)

use strict; use Set::Scalar; my $s = Set::Scalar->new( qw/yes no/ ); my $var = "no"; if ( $s->has($var)){ print "found $var\n"; } else{ print "never heard of $var\n"; }


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
Node Status?
node history
Node Type: note [id://665234]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (10)
As of 2014-07-30 05:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (229 votes), past polls