#!/usr/bin/perl ##Assume the following array having data in the matrix form. @a=( [qw(1 2 3)], [qw(1 2 3)], [qw(1 2 3)] ); for (my $j=0;$j <= ($#{$a[0]}) ;$j++) { my $sum=0; print "=======\n"; for(my $i=0;$i<=$#a;$i++) { print "[$i][$j]=$a[$i][$j] \n"; $sum+=$a[$i][$j]; } push @a, $sum; print "\n[$sum]\n"; } print "\naaaa===\n@a\n";
In reply to Re^2: sum of integers in a column
by sbmp111
in thread sum of integers in a column
by $new_guy
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |