I suspect your problem is that you are trying to find an easy-as-Perl way to do something that has no Perl shortcuts.
It comes up from time to time here; someone goes through the gyrations of learning to use HoH, which gives them the abililty to find data in complex structures with extremely lightweight code -- precisely what Hashes are designed to do.
Then they (or the people who inherit their code) suddenly discover that, lo and behold, sometimes you have to search the keys, too.
And they show up at the Monastery Gates looking for that magic shortcut way to get it done, since Perl "always" has those, only to discover that this is NOT what hashes were designed to do.
So, unfortunately, you're just going to have to search through the keys the old fashioned way. Anathema to Perl, perhaps, but, yes, you'll have to write five lines of Perl instead of one. :-)
By the way, there are technically at least two "old fashioned" ways to do this, not including going to external tools like SQL as admirably noted above.
One is as shown above, the looped and/or recursive search through the key tree.
The other is to rewrite the data storage portion of the script; at the same time it writes data to the hash, it then immediately also writes the key(s) to a reverse-lookup list (hash or array, depending on the need). Then you can search for your keys in the reverse-lookup list, often using those lovely Perl shortcuts we all get so accustomed to having at our fingertips.
Either way, sorry to say, this is not a new problem, and there is no silver bullet. You have to actually slog through the keys or change the way the data is stored in the first place.
In reply to Re: Search in Hash of Hash for the range of values
by marinersk
in thread Search in Hash of Hash for the range of values
by snape
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |