in reply to adding array elements
use 5.010; my @s; while (<DATA>) { my @e = split; $s[$_] += $e[$_] for 0 .. $#e; } say "@s"; [download]
You could also add up the elements on each line with sum from List::Util, so the code above would become:
use 5.010; use List::Util qw(sum); my @s; push @s, sum( split ) while <DATA> say "@s"; [download]