Do you know where your variables are? | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
Hi Perl monks.
I am in search of wisdom! I was wondering if you could explain a couple things for me from your example:
-- I'm not use to putting '$_' as a key for a hash. I am also not sure what '||=$_' means/does. Can you explain? I'm also not sure why you are deleting children...
Sorry for the newbie questions -- I've been dabbling in Perl for years, and I use hashes a lot but my syntax is still on the simple side. I have another question. Any tips on printing nested hashes? I use Data::Dumper all the time, but I usually just use the default output. What I am looking for is the "full path". For example, in the above example, we have this:
-- I'd like to print out something like this:
I usually just print each piece of the hash, which isn't too hard if I created the hash. For example, if I had a hash ref that had name/address information, I'd do something like:
But if the hash is created via autovivification (for example, let's say I am constructing a complex node tree from a parent-child list of several thousand nodes) I get stumped on how I'd be able to print the full path of each element in the hash. Does that make any sense? I am waking up and keeping two little kids from killing each other. ;) Any tips much appreciated!! Thanks. --Bryan In reply to various hash construction/ printing questions..
by bryank
|
|