Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Golf: Adding up array elements

by ioannis (Prior)
on Nov 02, 2005 at 16:57 UTC ( #505002=note: print w/replies, xml ) Need Help??


in reply to Golf: Adding up array elements

Besides brevity, it might also execute faster since Util.xs informs us that sum() is coded in C, as NV sum(...)

use List::Util qw(sum); print sum (my @arr = qw( 1 3 5 6));