Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: matrix - creating total row/column

by graff (Chancellor)
on Oct 14, 2009 at 01:48 UTC ( [id://800996]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    my %from_to_bytes;
    my %col_headings;
    ...
        $from_to_bytes{"~~TOTAL"}{$to} += $bytes;
        $col_headings{$to} = undef;
    }
    
  2. or download this
    print join("\t", '', sort keys %col_headings, 'Total'),"\n";
    for my $from ( sort keys %from_to_bytes ) {
        print (( $from eq '~~TOTAL' ) ? 'Total' : $from );
        print "\t$from_to_bytes{$from}{$_}" for (sort keys %{$from_to_byte
    +s{$from}});
    }
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://800996]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (5)
As of 2024-04-19 15:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found