You can do something like
if (grep exists $hash{$_}, 7..12) {but it's not necessarily any faster.
A hash is an unordered data type, so there's no easy way to search for a range. (There are some "ordered hash" packages on cpan, but that's really a misleading name.)
In reply to Re^3: Request help on optimizing a loop for looking up numbers
by Anonymous Monk
in thread Request help on optimizing a loop for looking up numbers
by VincentK
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |