$mean = eval(join("+", @data)) / @data;

I love perl golf.   =)

- B



> Dear all,
> 
> I want to calculate the mean of an array. I know how
> to let the job done by using a loop. But I just wonder
> if Perl has the short-cut/built-in function for this.
> 
> Thanks,
> 
> Li 
> 
> my @data=(1,1,1);
> 
> mean=(1+1+1)/3=1;(Any perl built-in function for
> this?)
> 
> 
> 
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com 



-- 
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