[oak perl] A Simple Problem

David Fetter david at fetter.org
Tue Mar 1 12:48:54 PST 2005


On Tue, Mar 01, 2005 at 12:47:31PM -0800, George Woolley wrote:
> Given one or more numbers in @numbers,
> how would you go about setting $total
> to the sum of @numbers.

my $total = 0;
map {$total += $_} @numbers;

Cheers,
D
-- 
David Fetter david at fetter.org http://fetter.org/
phone: +1 510 893 6100   mobile: +1 415 235 3778

Remember to vote!


More information about the Oakland mailing list