Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: covariance calculation

by amir_e_a (Hermit)
on Dec 28, 2009 at 18:54 UTC ( #814650=note: print w/replies, xml ) Need Help??


in reply to covariance calculation

What the other monks answered is correct, and here's a little addition:

The names of the variables $arraylref and $array2ref are hints that both of them are supposed to be references to arrays. \@sales is an array reference: the @ stands for "array" and \ stands for "reference". @hits, on the other hand, is just an array, not a reference.

Of course, you can't always count on variable names to hint at what they are supposed to be, but in this case it is correct.

Another hint that both of these variables really need to be references is the usage of the arrow operator -> in the line

$arraylref->[$i] * $array2ref->[$i];

The arrow operator is only used with references.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (5)
As of 2019-12-09 17:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?