Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: without looping, check if $var is found in @list

by sulfericacid (Deacon)
on Dec 14, 2006 at 03:09 UTC ( #589729=note: print w/ replies, xml ) Need Help??


in reply to without looping, check if $var is found in @list

I'd have to agree with duckyd on this one. A hash is probably the way to go on this one. This is my version..

my @choices = qq(one two three four five); my %choices; $choices{$_}++ for @choices; while ($sth->fetch) { if (exists $choices{$var}) { # } }


"Age is nothing more than an inaccurate number bestowed upon us at birth as just another means for others to judge and classify us"

sulfericacid


Comment on Re: without looping, check if $var is found in @list
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (4)
As of 2014-09-01 18:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite cookbook is:










    Results (15 votes), past polls