There's more than one way to do things | |
PerlMonks |
Re: How to check if a variable's value is equal to a member of a list of valuesby punch_card_don (Curate) |
on Mar 25, 2013 at 14:14 UTC ( [id://1025311]=note: print w/replies, xml ) | Need Help?? |
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.
In Section
Seekers of Perl Wisdom
|
|