in reply to Prefix and postfix increment/decrement operator query

What should be the output of
perl -le '$a = 10; $a++ + $a--'
Nothing of course! You aren't doing any I/O, so if your perl emits anything, it's broken!

Now, if you mean, "what is the value of $b after $a = 10; $b = $a++ + $a--?", then I suggest you RTFM instead of starting the same heated debate which runs through Perlmonks a few times a year.

Just RTFM. Then, if any question remains, come back.

Replies are listed 'Best First'.
Re^2: Prefix and postfix increment/decrement operator query
by saurabh.hirani (Beadle) on Jul 02, 2009 at 14:16 UTC

    @JavaFan - I meant -

    perl -le '$a = 10; print $a++ + $a--'

    Sorry for missing out on the print statement.

    Thanks davorg, wfsp for pointing to perlop and the Autoincrement magic link. I guess as it is undefined behavior I will leave it at that.