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";
In reply to Re^2: adding array elements
by chrestomanci
in thread adding array elements
by Sidac
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |