use strict; my @data; open(INPUT,'<',"monks.dat") or die("Can't open file"); while () { chomp; my @newdata = split(/ +/); for my $index (0 .. $#newdata) { $data[$index] += $newdata[$index]; } } close(INPUT);