![]() |
|
There's more than one way to do things | |
PerlMonks |
Slicing multilevel hashesby bobf (Monsignor) |
on Apr 07, 2005 at 17:14 UTC ( #445793=perlquestion: print w/replies, xml ) | Need Help?? |
bobf has asked for the wisdom of the Perl Monks concerning the following question: I'm trying to (ab)use hash slices. I understand the typical (@hash{@keys}) use of a slice, but now I'm trying to do something a bit more complex and take a slice of a hash of hashes. Using a slice in a %HoH when the list is provided as the second 'key' is no problem, but can slices be used to cut across the first set of keys as well? I didn't find anything when I searched for this in the docs or on PM. Perhaps a bit of code will help define the problem:
As illustrated in the code above, I used map to get it to work but if there is a way to use a slice I'd like to learn how to do it. Aside: If this is possible, though, it immediately implies one could slice across both directions at once:
Thanks! Update: clarified the main question
Back to
Seekers of Perl Wisdom
|
|