in reply to Re: Equivalency of Code
in thread Equivalency of Code

No fair!

HIS code didn't have print statements in it, he was using them as standalone statements. You are testing something different.
$x = 3; $x++; print $x;
$x = 3; $x += 1; print $x;
...would be more accurate.

Of course, given problems with operator overloading, they stil arn't actually equal.

Replies are listed 'Best First'.
Re^3: Equivalency of Code
by DrHyde (Prior) on Feb 08, 2005 at 10:39 UTC
    The point is that $x++ and $x += 1 don't just fiddle with the value of $x. Those statements also have values themselves. If a bit of code is to be equivalent to another, then it needs to both have the same side-effects and the same value as the other does.

    I try not to think about operator overloading or tieing :-)

      The statements are presented where in void context - and in void context, there's no return value.