in reply to Pre vs Post Incrementing variables

In this:

my $i = 0; my ($j, $k) = (++$i, ++$i); print "\$j: $j\t\$k: $k\n"; $j: 2 $k: 2

It first evaluates the ++es (because it's a pre-increment, so it happens before anything else), so $i = 2. Then, it builds a list of (2, 2), and finally assigns that list to ($j, $k).

In this:

my $i = 0; my ($j, $k) = ($i++, $i++); print "\$j: $j\t\$k: $k\n"; $j: 0 $k: 1

Because it's a post-increment, the ++es get evaluated *after* $i is "evaluated" to build the list. So the first $i is evaluated, it's 0, so 0 goes into the list. Then the ++ happens, setting $i = 1. Then the next $i is evaluated, putting 1 into the list, and finally $i is incremented again. End result, a list of (0, 1) is assigned to ($j, $k).

But as others have pointed out, having multiple ++es and --es in a statement is Bad Juju. What I've explained is what happens in current perls, but I wouldn't trust it to work the same in the next point release of perl 5, let alone in perl 6. See perlop.