>>>>> "Xavier" == Xavier Noria <[EMAIL PROTECTED]> writes:
Xavier> On Sep 9, 2006, at 9:00 PM, chen li wrote: >> 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. Xavier> There are modules, but nothing builtin. List::Util is "built-in" as of 5.8, and back compatible to 5.5 I think. use List::Util qw(sum); my $average = sum(@input) / @input; -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 <merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/> Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training! -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>