in reply to "$_" vs. $_
In my opinion, $_ springs into being when Perl feels it's appropriate -- it's an auto-vivified rvalue.
On the other hand, $_ is *never* an lvalue unless you're using a regexp to modify the value, as in $_ =~ s/foo/bar/;, and even that's stretching a point, because of course uou can do the same thing with just s/foo/bar/;
So I would say that any code that *sets* $_ is, by definition, wrong.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: "$_" vs. $_
by bsdz (Friar) on Apr 08, 2007 at 06:59 UTC | |
by ikegami (Patriarch) on Apr 08, 2007 at 07:24 UTC | |
by bsdz (Friar) on Apr 08, 2007 at 08:40 UTC | |
by ikegami (Patriarch) on Apr 08, 2007 at 15:39 UTC | |
| |
|
Re^2: "$_" vs. $_
by mrpeabody (Friar) on Apr 09, 2007 at 03:25 UTC | |
by Beechbone (Friar) on Apr 10, 2007 at 14:31 UTC | |
by mrpeabody (Friar) on Apr 10, 2007 at 19:47 UTC |