in reply to Finding hash key related to closest value

IMHO you should rather use an array storing the values in 0.1 steps. (with a variable holding the start offset, here -4)

Like this you can use a linear search forward and backward (or even binary if speed maters) to determine the range limits you wanna find.

Keep in mind that hashes are unsorted but you need to compare neighbors.

Cheers Rolf

( addicted to the Perl Programming Language)

  • Comment on Re: Finding hash key related to closest value