A
Alf McLaughlin
Hello all-
It seems I am running across the following problem a lot recently.
Let's say I have a large collection of values and they are in an array
(perhaps there are 10,000 of them). I would like to pull out all
values between $x and $y without having to loop through the entire
array to figure out where the values I'm interested in are locating.
Is there a simple way to do this in Perl? For example, in SQL I would
write something like this:
SELECT position FROM my_table WHERE position BETWEEN 14000 and 1479;
Perhaps the answer involves storing the data in a different structure
(I can picture this working very quickly if the values I'm interested
in were keys in a hash, but I still don't know how to do it).
Thanks,
Alf
It seems I am running across the following problem a lot recently.
Let's say I have a large collection of values and they are in an array
(perhaps there are 10,000 of them). I would like to pull out all
values between $x and $y without having to loop through the entire
array to figure out where the values I'm interested in are locating.
Is there a simple way to do this in Perl? For example, in SQL I would
write something like this:
SELECT position FROM my_table WHERE position BETWEEN 14000 and 1479;
Perhaps the answer involves storing the data in a different structure
(I can picture this working very quickly if the values I'm interested
in were keys in a hash, but I still don't know how to do it).
Thanks,
Alf