Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: Making a match

by perlplexer (Hermit)
on Apr 12, 2003 at 13:35 UTC ( #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
Node Status?
node history
Node Type: note [id://250053]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (7)
As of 2021-03-02 20:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My favorite kind of desktop background is:











    Results (62 votes). Check out past polls.

    Notices?