In order to store various data generated as a script runs, I've ended up with a routine that looks like this (variable names changed for a shorter post) ;):
{ $a{$b}{$c}{$d}[$e]++; }
What this is supposed to be doing is counting the number of strings found in file $b that are of group $c and subgroup $d and length $e. Loading this structure up works nicely according to the output of Data::Dumper. The next problem is that I need to produce several summary files:
1. The number of items of group $d of length N (where N is 1 to a max. length determined elsewhere) found in $b.
2. The same as 1, but grouping by $c.
3. The number and length of $d summed for all the files.
4. The same as 3, but grouping by $c.
Looking at the dumped output I see:
file_b
{
  group_c_item => {
     'group_d_item' =>  
          [
          undef,
          undef,
          N
          ]                         
                  }
};
...where N is the number of items of length 3. Can anyone suggest a simple way of printing this output so I could get something like:
length|unique_d_1|unique_d_2|...etc
1     |     1    |      0   |
2     |     2    |      4   |
3     |     0    |      2   |
etc...
...for example? I've tried a few ugly loops, but with no success.

In reply to Extracting data from nested hashes by knirirr

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.