On Friday 14 July 2006 11:00 pm, I BioKid wrote:
> is there any shortest way to add a list of random numbers ?
> for example :
> 11
> 1
> 250
> 39
> 100

Whatever happened to good old:

        my (@data,$result);
        @number = (1,2,3);
        $sum = 0;
        foreach(@number) {
                $sum += $_;
        }

I think we should use this kind of algorithm in answer to a newbie's question. 
Or have I, learned colleagues, missed something?

Tom Arnall
North Spit, CA




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to