http://www.perlmonks.org?node_id=1184051


in reply to How can I add all the numbers in an array with out doing a foreach loop?

He's a rather ridiculous solution which avoids using the addition operator. It only works for positive integers.

my @quans = (2, 5, 8, 12, 15, 88); my $total = scalar(map {1 .. $_} @quans); print "$total.\n";