Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Different behaviour of count++ or misunderstanding?

by hdb (Prior)
on Apr 11, 2014 at 09:39 UTC ( #1081937=note: print w/ replies, xml ) Need Help??


in reply to Different behaviour of count++ or misunderstanding?

In the first iteration $count++ evaluates to zero and thus the and short-circuits and the push is not executed. If you compare the contents of @test_array in both cases you will see that the first element is missing.


Comment on Re: Different behaviour of count++ or misunderstanding?
Select or Download Code
Re^2: Different behaviour of count++ or misunderstanding?
by vagabonding electron (Hermit) on Apr 11, 2014 at 10:10 UTC

    Thank you very much! After changing $count++ to ++$count there is no difference anymore.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (14)
As of 2015-07-07 14:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (89 votes), past polls