in reply to Re^4: Will "$_[0]=shift" always resolve shift first?
in thread Will "$_[0]=shift" always resolve shift first?
You will find the following code equivalent to $array[++$x] = ++$x;:
do { local @_; alias $_[0] = ++$x; # Aliases to $x alias $_[1] = $array[++$x]; $_[1] = $_[0] };
As you can see, the LHS is fully evaluated before the RHS, yes you still get the effect you say can't happen under those conditions.
If you don't have Data::Alias (like me), you can use the following code:
do { our $arg0; local *arg0 = \( ++$x ); our $arg1; local *arg1 = \( $array[++$x] ); $arg1 = $arg0; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^6: Will "$_[0]=shift" always resolve shift first?
by GrandFather (Saint) on Sep 09, 2008 at 03:16 UTC |