in reply to Re^4: using shift and $_ in loop
in thread using shift and $_ in loop
$_ is .. what of the caller?
$_ is $_. No telling how the caller is using it.
And am I to understand that in sub a, messing with @_, regardless if the caller passed any references as arguments, is potentially messing with the caller's arguments?
Easy to test...
Not quite. Messing with the elements of @_ will. Adding elements and removing elements (including assigning to @_ specifically) won't.
is basically equivalent tofoo($x, $y+1, $z);
{ local @_; alias $_[0] = $x; alias $_[1] = $y+1; alias $_[2] = $z; &foo; }
Changing $_[0] in foo will change $x, for example.
|
|---|
| Replies are listed 'Best First'. |
|---|