Though this does not check whether the amount of fields is actually the same or not :)use strict; my @data; open(INPUT,'<',"monks.dat") or die("Can't open file"); while (<INPUT>) { chomp; my @newdata = split(/ +/); for my $index (0 .. $#newdata) { $data[$index] += $newdata[$index]; } } close(INPUT);
In reply to Re: adding array elements
by Neighbour
in thread adding array elements
by Sidac
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |