in reply to Multi-Column Totals
which gives:#!/usr/bin/perl -w use strict; $\ = "\n"; my @total; foreach my $row ( 1 .. 10 ) { my @output; foreach my $column ( 1 .. 10 ) { push @output , $column; $total[$#output] += $column; } print join ',' , @output; } # print column totals here print 'total:'; print join ',' , @total;
1,2,3,4,5,6,7,8,9,10 1,2,3,4,5,6,7,8,9,10 1,2,3,4,5,6,7,8,9,10 1,2,3,4,5,6,7,8,9,10 1,2,3,4,5,6,7,8,9,10 1,2,3,4,5,6,7,8,9,10 1,2,3,4,5,6,7,8,9,10 1,2,3,4,5,6,7,8,9,10 1,2,3,4,5,6,7,8,9,10 1,2,3,4,5,6,7,8,9,10 total: 10,20,30,40,50,60,70,80,90,100
|
|---|