It's a little bit harder to answer when your example is thus simplified. It looks like you got your answer, anyway.
(I might've suggested:)
sub second { my $sum = 0; $sum += $_ for 6, @{+shift}; $sum }
In reply to Re^3: Preserve the value of original array
by ayrnieu
in thread Preserve the value of original array
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |