How about this? Still lots of open questions...

I have ignored the first 3 columns as they do not seem to make any difference (even though they have different entries, these differences are ignored in your desired output). In order to check whether columns line up properly, open in Excel with TAB delimited.

use strict; use warnings; my %output; my %total; while (my $line = <DATA>){ chomp $line; my @field = split /\s+/, $line; # fields 0, 1, 2 do seem to be required $output{$field[3]}{$field[4]}{$field[5]}{COUNT} += $field[6]; $output{$field[3]}{$field[4]}{$field[5]}{VALUE} += $field[7]; $total{$field[3]}{COUNT} += $field[6]; $total{$field[3]}{VALUE} += $field[7]; $total{TOTAL}{COUNT} += $field[6]; $total{TOTAL}{VALUE} += $field[7]; } print "Summary\n"; print "\tDetailed Summary\n"; for my $k1 (sort keys %output){ for my $k2 ( sort keys %{ $output{$k1} } ) { for my $k3 ( sort keys %{ $output{$k1}{$k2} } ) { print "\t\tEMC\t$k1\t$k2\t$k3\t$output{$k1}{$k +2}{$k3}{COUNT}\t$output{$k1}{$k2}{$k3}{VALUE}\n"; } } print "\t\tEMC\t$k1\tTOTAL\t\t$total{$k1}{COUNT}\t$total{$k1}{ +VALUE}\n"; } print "\tDetailed Summary\tTOTAL\t\t$total{TOTAL}{COUNT}\t$total{TOTAL +}{VALUE}\n"; print "Summary\n"; __DATA__ Summary Detial_Summary EMC CHECK abcdefghi AZ_checker 1 20.32 Summary Detial_Summary EMC CHECK abcdefghi AZ_checker 1 24.00 Summary Detial_Summary EMC CHECK KBCDEFGHI AZ_checker 1 10.00 Summary Detial_Summary EMC CHECK KBCDEFGHI AZ_checker 1 14.00 Summary1 Detial_Summary1 EMC CHECK1 abcdefghi AZ_checker 1 20.59 Summary1 Detial_Summary1 EMC CHECK1 abcdefghi AZ_checker 1 24.00 Summary1 Detial_Summary1 EMC CHECK1 HGIJHKKIF AZ_checker 1 10.00 Summary1 Detial_Summary1 EMC CHECK1 HGIJHKKIF AZ_checker 1 14.00

In reply to Re: Hashes of Hash in perl by hdb
in thread Perl Hash by Rajsai2825

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.