in reply to Re: pre v.s. post (increment/decrement)
in thread pre v.s. post (increment/decrement)
Yes, that is correct. One cool use I've seen for post-increment is in object initialization when the Damien Conway prevents multiple inheritance:
return if ($self->{_init}{Object}++);
This returns control to the calling execution if the initializing function has already been called in the inheritance hierarchy. If it hasn't already been initialized, it increments and proceeds. If it has already been initialized, it returns.
|
|---|