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

perlguru22 has asked for the wisdom of the Perl Monks concerning the following question:

How can you find the sum of an array using just shift and pop?
#! usr/bin/perl @nums = (1,2,3,4); $s = shift@nums; \\ I know that gives $s 1 $p = pop@nums; \\ This gives $p 4 $sum += $_ for @nums; print "$sum";
I tried using a for loop but I don't think that worked either.