chen li wrote: > Dear all, Hello,
> 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. > > my @data=(1,1,1); > > mean=(1+1+1)/3=1;(Any perl built-in function for > this?) my $mean = do { my $s; $s += $_ for @data; $s / @data }; John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>