Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: How to check if a variable's value is equal to a member of a list of values

by punch_card_don (Curate)
on Mar 25, 2013 at 14:14 UTC ( #1025311=note: print w/replies, xml ) Need Help??


in reply to How to check if a variable's value is equal to a member of a list of values

If your values are members of ranges, you could go through the list once at startup and remember just the start/ends of the ranges, then compare to those. For example, if your list is like:

1, 2, 3, 4, 5, 453, 454, 455, 456, 457, 458

You'd remember only 1 - 5 and 453 - 458, then check if x is within any stored ranges.




Time flies like an arrow. Fruit flies like a banana.
  • Comment on Re: How to check if a variable's value is equal to a member of a list of values
  • Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1025311]
help
Chatterbox?
[shmem]: Lady_Aleena: see perlsub for AUTOLOAD
[Discipulus]: well AUTOLOAD does auto load (if nothing is found you know what to do)
Lady_Aleena goes to read, may take a bit.
[Lady_Aleena]: Um, okay...
[karlgoethebier]: Lady_Aleena see also the source code of Shell

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (8)
As of 2017-06-26 08:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How many monitors do you use while coding?















    Results (574 votes). Check out past polls.