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


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

How about as a subroutine?

sub sumit { my $sum = 0; $sum += pop // return $sum while 1; }

  • Comment on Re: How can I add all the numbers in an array with out doing a foreach loop?
  • Download Code