Beefy Boxes and Bandwidth Generously Provided by pair Networks RobOMonk
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Statistic in Perl(Using Subroutines)

by jwkrahn (Monsignor)
on Jul 10, 2013 at 23:09 UTC ( #1043587=note: print w/ replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    sub average {
    @_ == 1 or die ('Sub usage: $average = average(\@array);');
    ...
    foreach (@$array_ref) { $sum += $_; }
    return $sum / $count;
    }
    
  2. or download this
    sub average {
        ref( my $array_ref = $_[ 0 ] ) eq 'ARRAY'
    ...
        return $sum / @$array_ref;
        }
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1043587]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (9)
As of 2014-04-17 10:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (444 votes), past polls