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" } ] } }

In reply to Re^3: Dump filtered subtree? by Anonymous Monk
in thread Dump filtered subtree? by LanX

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.