Perl Monk, Perl Meditation | |
PerlMonks |
Hash of hash: testing for existence of higher level key (only)by zuma53 (Beadle) |
on Jun 22, 2012 at 04:18 UTC ( [id://977760]=perlquestion: print w/replies, xml ) | Need Help?? |
zuma53 has asked for the wisdom of the Perl Monks concerning the following question:
Let's say I have the following hash entries:
I'd like to query the hash, but all I am given for inputs for queries are just values for the first two keys. Some examples: A/B5, A/B9, C/B2. If there's a hit (eg A/B5), then I could ask for the keys and iterate through that subhash. My (limited) understanding of a hash is that for a 3-tier hash like this, you must always provide all 3 keys to get to test for existence. I thought of but I don't think that would work, as Perl would think that's another hash enitrely. Or maybe something like Is there a way to do this without iterating through the levels of the HoH? Thanks.
Back to
Seekers of Perl Wisdom
|
|