Ido has asked for the wisdom of the Perl Monks concerning the following question:
Will, obviously, not work, as it tries to modify a read-only value.sub m{ $_[0]=~s///; } m("String");
*_=\"Hello"; s///;
Will run. Which is weird, as $_ is an alias to $_[0] which is an alias to a readonly value. $_[0] won't change, but $_ will, which is again weird, as $_ should be an alias to it. Can someone clarify what's going on to me?sub m{ local *_=\$_[0]; s///; } m("String");
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Argument list item alias-ing
by broquaint (Abbot) on Apr 16, 2003 at 11:02 UTC | |
|
Re: Argument list item alias-ing
by Ido (Hermit) on Apr 16, 2003 at 11:11 UTC | |
by broquaint (Abbot) on Apr 16, 2003 at 13:40 UTC | |
|
Re: Argument list item alias-ing
by nothingmuch (Priest) on Apr 16, 2003 at 12:14 UTC |