Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
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 perusing the Monastery: (6)
As of 2015-07-03 18:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (55 votes), past polls