in reply to Pre-increment *and* Post-increment

Perl follows the C convention for the increment/decrement operators, or nearly so. ++$foo++ is undefined because only one *-ment op is allowed per variable in a statement. Would you like that to do (++$foo)++, or ++($foo++) ? It would make a difference, but there is nothing in the grammar to distinguish them.

After Compline,
Zaxo

Replies are listed 'Best First'.
Re^2: Pre-increment *and* Post-increment
by ikegami (Patriarch) on Feb 01, 2005 at 19:31 UTC
    (++$foo)++ and ++($foo++) don't work either, for reasons mentioned by ambrus.