in reply to Re^2: Dump filtered subtree?
in thread Dump filtered subtree?

These are all good tools, some even extract the path. But I couldn't find an example of reducing a complex data structure to essential parts.

find_rehohy( $VAR1 ); sub find_rehohy { my( $root ) = @_; my $my_cb = sub { my $val = pp( $_[0] ); my $path = $_[1]; my $depth = $_[2]; my @Paths = @{ $_[3]||[] }; my $depthpad = ( " " x $depth ); my $varname = shift @Paths; # print "DiveVal( $varname, qw/ @{[ @Paths ]} /)\n$depthpad = $val +; #d$depth\n\n"; use Data::Diver qw/ DiveVal /; use Data::Printer; if( $Paths[-1] eq 'field' ){ p( @Paths ); my $reff = 'HASH' eq ref $root ? {} : []; DiveVal( $reff , @Paths ) = $_[0]; p $reff ; return; } return; }; rehohy( $root, 0=> '$ref->' , $my_cb ); } __END__ [ [0] "content", [1] "errors", [2] 0, [3] "field" ] \ { content { errors [ [0] { field "merge_fields" } ] } }