in reply to Re^2: getting keys of multi-level hashrefs
in thread getting keys of multi-level hashrefs
All occurrances of $_ are now replaced by $key, and all occurrances of $hr_data->{$_} are now replaced by $value.sub DigThroughHashref { my $hr_data = shift; while (my ($key, $value) = each %{$hr_data}) { if (ref ($value) eq "HASH") { print ("Digging through [$key]:\n"); DigThroughHashref($value, @_, $key); } else { print (join ('->', @_) . "->$key - $value\n"); } } ## end while (my ($key, $value) ... } ## end sub DigThroughHashref
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: getting keys of multi-level hashrefs
by mask_man (Initiate) on Jul 07, 2010 at 20:12 UTC | |
by Neighbour (Friar) on Jul 08, 2010 at 09:50 UTC |