CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Regular Expressions: Re: [blackeagle225] Reading two lines at a time: Edit Log



FishMonger
Veteran / Moderator

Jun 23, 2011, 8:00 AM


Views: 4429
Re: [blackeagle225] Reading two lines at a time

I'd do it like this:

Code
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)


Edit Log:
Post edited by FishMonger (Veteran) on Jun 23, 2011, 8:05 AM


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives