in reply to Re: How to find all occurrences of a key in a deeply nested structure?
in thread How to find all occurrences of a key in a deeply nested structure?
my $struct = {...}; # the hash of hashes in the question my $found; Data::Walk::walk \&wanted, $struct; print join(" ",sort keys %$found) ,"\n"; sub wanted{ if (/^values$/){ foreach ( keys %{$Data::Walk::container->{$_}} ){ $found->{$_}=1; } } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: How to find all occurrences of a key in a deeply nested structure?
by Anonymous Monk on Oct 20, 2011 at 15:40 UTC | |
by deMize (Monk) on Oct 20, 2011 at 17:09 UTC | |
by Anonymous Monk on Oct 21, 2011 at 00:55 UTC |