|
|
|
Clear questions and runnable code get the best and fastest answer |
|
| PerlMonks |
Adding to hash of hashesby Dlamini (Novice) |
| on Aug 24, 2012 at 23:31 UTC ( #989657=perlquestion: print w/ replies, xml ) | Need Help?? |
|
Dlamini has asked for the
wisdom of the Perl Monks concerning the following question:
Hi Monks Is there an idiomatic way to add key/value pairs to a hash of anonymous hashes? For example, if I already have:
but then I want to add an end => 10 to the same anonymous hash without replacing what's already there. I guess the problem is that the hash, being anonymous, doesn't have a name through which I can access it (other than with keys %hoh -- or does it?). So I can extract the anonymous hash to the top level, add to it, then replace what used to be there like so: but I was wondering if there is a better, more standard, idiomatic way to do this? Thanks in advance... Dlamini
Back to
Seekers of Perl Wisdom
|
|
||||||||||||||||||||||||||||||