in reply to Re: adding array elements
in thread adding array elements
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";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
| A reply falls below the community's threshold of quality. You may see it by logging in. |