Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: writing perl function like sql IN

by blokhead (Monsignor)
on Aug 31, 2004 at 00:26 UTC ( [id://387073]=note: print w/replies, xml ) Need Help??


in reply to writing perl function like sql IN

Quantum::Superpositions might give the most readable way to do this:
use Quantum::Superpositions; if ( $x == any(1,3,7) ) { ... }
A hash is better than an array or quickly checking of whether an item is included. If you can keep the set of candidates around as a hash with candidates as keys instead of an array of candidates, you can check whether a key is one of the candidates with exists.

blokhead

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (5)
As of 2024-04-19 06:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found