Keep It Simple, Stupid | |
PerlMonks |
Re: $i=$i++by dsb (Chaplain) |
on Apr 29, 2002 at 15:41 UTC ( [id://162841]=note: print w/replies, xml ) | Need Help?? |
++Ovid, but I have one more point.
I ran the following code: And got the following output: Remebering what Ovid said about pre vs. post increment, when you examine this output you may realize that by the time the print statements in Test2, Test3, and Test4 have been executed, $i has actually been incremented one last time by the post increment operator. So if you thought your output was weird maybe this has something to do with it. UPDATE: I was going through my posts and found this one. The final incrementation I mention I believe is ultimately irrelevant since the expression's return value i assigned to $i thereby over-writing the value $i has after the ++ operator.
Amel
In Section
Seekers of Perl Wisdom
|
|