Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: matrix - creating total row/column

by graff (Chancellor)
on Oct 14, 2009 at 01:48 UTC ( #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? | Other CB clients
Other Users?
Others about the Monastery: (3)
As of 2021-11-27 02:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?