in reply to Lookup closest hash key

How many cities? And across what range (Ie. minimum and maximum distance)?

Depending upon your answers to those questions, there is probably an O(1) solution.

Replies are listed 'Best First'.
Re^2: Lookup closest hash key
by Just in (Sexton) on Jan 25, 2011 at 16:02 UTC

    I have possibly over simplified my concern. But your replies negate the need for a hash, which confirms my suspicions. The module pointers are excellent, their reading will prove useful for similar problems.

    That said Tie::RangeHash looks very useful, and I'll do some benchmarking to see if it's worth while.

    The hash implementation I used should work for the time being, however I suspect that the actual data source will grow in magnitudes making db interaction and SQL statements more attractive. Again more benchmarking.

    My most heartiest thanks for the pointers and replies.