The map function lets you apply some code to each element of a list. Usually, your code won't have any side effects; indeed, the documentation does not guarantee a particular evaluation order. In practice, elements are evaluated in order, so we can write this code to keep a running count of the values in @a.
my $sum; @sums = map {$a += $_} @a;