in reply to Which way is recommended ?
instead of directly using $_
The term "directly" is not quite correct here, because it suggests that $_ is used in any case.
$_ will not be set if you write while( my $line = <$lfh> ).
In my opinion, using $_ is not really elegant. It's a global variable and it will be visible to called subroutines even if you localize it. Well, in perl 5.10 you can avoid this my using my $_. But unlike with named variables, you won't get any errors from strict if you forget to my the variable.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Which way is recommended ?
by DStaal (Chaplain) on Nov 21, 2008 at 20:42 UTC | |
Re^2: Which way is recommended ?
by matrixmadhan (Beadle) on Nov 21, 2008 at 19:15 UTC | |
by TGI (Parson) on Nov 22, 2008 at 02:19 UTC |
In Section
Seekers of Perl Wisdom