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

No, don't do that, do it the way I did it :) except only push if not $Data::Walk::seen
  • Comment on Re^3: How to find all occurrences of a key in a deeply nested structure?

Replies are listed 'Best First'.
Re^4: How to find all occurrences of a key in a deeply nested structure?
by deMize (Monk) on Oct 20, 2011 at 17:09 UTC
    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 :)
      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; }