in reply to Re^3: 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?

But that would return duplicates and not a unique set, which is why I was storing in a hash, to do the cleanup for me :)
  • Comment on Re^4: How to find all occurrences of a key in a deeply nested structure?

Replies are listed 'Best First'.
Re^5: How to find all occurrences of a key in a deeply nested structure?
by Anonymous Monk on Oct 21, 2011 at 00:55 UTC
    Ok, like this
    print join ' ', UniqueWalkers( $struct ); sub UniqueWalkers { my %found; Data::Walk::walk( sub { if (/^values$/) { foreach ( keys %{ $Data::Walk::container->{$_} } ) { $found{$_}++; } } return; }, @_ ); return sort keys %found; }