http://www.perlmonks.org?node_id=767995


in reply to Operator Associative in Perl

Basically what you are saying is, "give me the value of $a, increment it sometimes afterwards", "give me the value of $a, decrement it sometimes afterwards", "give me the value of $a but only after you've incremented it", "give me the value of $a, but only after you've decremented it". Note that you never say at which moment the value of $a needs to change, just that it needs changing sometime before (or after) fetching the value.

Getting 56555 is not unreasonable. But another result wouldn't have been unreasonable either. In general, it's a bad idea to use ++ or -- twice on the same variable in the same statement is a bad idea. Or to assign to a variable in the same statement as you apply ++ or -- to that variable.