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.

Replies are listed 'Best First'.
Re^2: Different behaviour of count++ or misunderstanding?
by vagabonding electron (Curate) on Apr 11, 2014 at 10:10 UTC

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