in reply to Array slice out of order
Heheh ... in C, that would be called "undefined behaviour". Any behaviour, including formatting of the author's hard disk (even if not running on the author's machine), is allowed.
It all depends on the order that perl evaluates the expression. It looks like perl evaluates the subscripts from right to left in this case, so it evaluates the $i++ (incrementing i after putting a zero there), and then evaluates the $i (putting the newly-incremented value of one there), and then splices. Neat!
Update:Slight clarification (emphasised) (thanks dragonchild and cog)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Array slice out of order
by dragonchild (Archbishop) on Feb 03, 2005 at 18:50 UTC | |
|
Re^2: Array slice out of order
by halley (Prior) on Feb 03, 2005 at 18:33 UTC | |
|
Re^2: Array slice out of order
by cog (Parson) on Feb 03, 2005 at 18:54 UTC |