Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
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 examining the Monastery: (8)
As of 2014-09-22 11:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (189 votes), past polls