You should notice that Perl arrays are autovivified, where if you use an index out of range, the array will be auto-expanded.
So what you need is: use an array to record the sum of columns. each time you read a line, and add the columns to the sum array.
my @sum; while (<FH>) { chomp; my @F = split /\t/; $sum[$_] += $F[$_] for 0..@F-1; }
In reply to Re: How can you make this script general?
by llancet
in thread How can you make this script general?
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |