Welcome to the Monastery | |
PerlMonks |
Re: Which way is recommended ?by betterworld (Curate) |
on Nov 21, 2008 at 18:59 UTC ( [id://725208]=note: print w/replies, xml ) | Need Help?? |
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.
In Section
Seekers of Perl Wisdom
|
|