Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: covariance calculation

by amir_e_a (Hermit)
on Dec 28, 2009 at 18:54 UTC ( [id://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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://814650]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (4)
As of 2024-04-16 06:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found