[oak perl] A Simple Problem

Kester Allen kester at gmail.com
Tue Mar 1 12:42:40 PST 2005


I like the module solution:

use List::Util qw/sum/
@numbers = qw/3 9 12 1 2/;
$tot = sum ( @numbers );
print $tot;

On Tue, 1 Mar 2005 12:47:31 -0800, George Woolley <george at metaart.org> wrote:
> Given one or more numbers in @numbers,
> how would you go about setting $total
> to the sum of @numbers.
> [This is a problem from another Perl group.]
> 
> _______________________________________________
> Oakland mailing list
> Oakland at pm.org
> http://mail.pm.org/mailman/listinfo/oakland
>


More information about the Oakland mailing list