in reply to Search a hash for closest match
Hashes don't help with finding nearest, only exact matches.
You would be better using a HoAs rather than a HoHs:
$hash{ 1 } = [ 15, 49, 51, 79 ];
And then use a binary search to find the closest position.
More information about the details of your data might lead to a more efficient solution.
Ie. What is the range of the positions? How many chr/pos pairs in your hash? How many lookups do you need to do?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Search a hash for closest match
by aquinom (Sexton) on Nov 01, 2011 at 17:40 UTC | |
by BrowserUk (Patriarch) on Nov 01, 2011 at 19:02 UTC |