in reply to Lookup closest hash key

my %distances = ( 452 => 'London', 678 => 'Paris', 890 => 'Rome', );
> would it be possible to get the value Paris by looking up the non existent key of 672?

Sure, add the non-existent key 672 pointing to Paris as nearest neighbor! :)

Seriously, a one kilometer grid of distances on earth only means precalculating at most 20000 entries (but better use an array then).

You can also go for a compromise and add a wider grid to the hash, like e.g. 10 kilometers. (The optimal width depends on your data).

Now rounding 672 to 670 and 680 will lead you to precalculated hash entries pointing to Paris. Can't be much faster...