Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: Making a match

by perlplexer (Hermit)
on Apr 12, 2003 at 13:35 UTC ( [id://250053]=note: print w/replies, xml ) Need Help??


in reply to Making a match

How often does this need to be executed?
If you only need to perform the check once, use grep(), as the Anonymous Monk already suggested.
If, however, the check needs to be performed multiple times, say, in a loop, you'll be better off putting those numbers in a hash and then using exists(); e.g.,
my %numbers = (); @numbers{10..15,17,18,22..35} = (); if (exists $numbers{$x}){ # do stuff }
--perlplexer

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (4)
As of 2024-04-25 07:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found