Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw

Re^2: Average/mean calculator

by Paradizingmania (Initiate)
on Jun 04, 2014 at 18:54 UTC ( #1088722=note: print w/replies, xml ) Need Help??

in reply to Re: Average/mean calculator
in thread Average/mean calculator

hey 3 questions, first what does the <= mean second what does the line $total += $num; and last what does the $count++ mean, i am still new to this so keep that in mind, and thanks for the help

Replies are listed 'Best First'.
Re^3: Average/mean calculator
by roboticus (Chancellor) on Jun 04, 2014 at 20:13 UTC


    You should read the perlop documentation, it describes what all the operators are. Having said that:

    • $a <= $b means "$a is less than or equal to $b"
    • $total += $num means the same as $total = $total + $num
    • $count++ means the same as $count = $count+1


    When your only tool is a hammer, all problems look like your thumb.

Re^3: Average/mean calculator
by Laurent_R (Canon) on Jun 04, 2014 at 20:23 UTC
    Hi Paradizingmania,

    Roboticus has given you the answers to your questions, but I should stress these questions relate to really basic Perl operators, and that you should absolutely take a serious look at the documentation pointed by him in his answer (perlop). Also take a look at the documentation pointed out by toolic, especially perlintro.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1088722]
[mithaldu]: ugh, i'm glad my question got a useful answer, but i am disheartened to see that, stackoverflow- style, the correct answer is buried below one that looks superficially appropiate, but entirely misses the point of the question
[hippo]: Hardly "buried". Just upvote the good nodes and move on.

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (4)
As of 2018-08-14 08:45 GMT
Find Nodes?
    Voting Booth?
    Asked to put a square peg in a round hole, I would:

    Results (146 votes). Check out past polls.