I might have been a touch confused as to what you were asking. Adding this

elsif(ref($ref) eq '') { $sub1->('',''); print 'undef'; } # scalar
before
if ($lastc){
prints all scalars as undef.
$hash={1AoH=>[{h1=>{a=>undef} }, {h2=>{a=>undef} }, {h3=>{a=>undef} } ], 2Aoa=>[[undef, undef, undef ], [undef, undef, undef ] ], 3AoAoH=>[[{2=>undef, a=>undef }, {2=>undef, a=>undef }, {axx=>{a=>undef} } ] ], 4HoHoA=>{a11=>[{h111=>{a=>undef} }, {h211=>{a=>undef} }, {h311=>{a=>undef} }, undef ], a22=>[{h122=>{a=>undef} }, {h222=>{a=>undef} }, {h322=>{a=>undef} }, undef ] }, 5HoH=>{a411=>{h1111=>{a=>undef}, h4112=>{h41121=>{a=>undef} }, h4113=>{h41131=>{a=>undef} }, h4114=>undef }, a422=>{h422a=>{a4222=>{h42221=>{a=>undef} }, a4223=>{h42231=>{a=>undef} }, h4221=>{a=>undef, b=>undef } }, h422b=>undef }, a433=>{a=>undef, b=>undef, c=>undef } }, Clean=>{extra=>{}}, Domains=>{}, Lists=>{Body=>{RedactedWordList=>{weight=>undef, words=>{word1=>undef, word2=>undef }, words_found=>[] } } }, Words=>{}, flags=>{Redacted=>undef, Redacted2=>undef, Redacted3=>undef, Redacted4=>undef, example=>undef, font_attributes=>{colors=>undef, size=>undef }, font_changes=>{colors=>undef, size=>undef } }, other_results=>{}, recipient_list=>[undef], removed_results=>[undef, undef, undef ], result=>undef };


In reply to Re^2: Traversing a hash of hashes of hashes by huck
in thread Traversing a hash of hashes of hashes by kcorj2244

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.