
FishMonger
Veteran
Jun 23, 2011, 8:00 AM
Views: 3228
|
|
Re: [blackeagle225] Reading two lines at a time
|
|
|
I'd do it like this:
while ( my $line1 = <$fh> ) { my $line2 = <$fh>; } My reasons: 1) it uses a lexical var for the filehandle, 2) it declares both vars in the smallest scope that the require, and 3) it doesn't needlessly use $_.
(This post was edited by FishMonger on Jun 23, 2011, 8:05 AM)
|