Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: Text File Section Extractor

by telemachus (Friar)
on Apr 10, 2009 at 02:05 UTC ( #756737=note: print w/replies, xml ) Need Help??


in reply to Text File Section Extractor

I second toolic's suggestion of range operators as a way to simplify the extraction itself.

Two other small things: first, check out the 3 argument form of open with lexical filehandles. You get the general benefits of lexical variables, and these filehandles are far easier to pass around. Second, autodie saves you from a lot of boilerplate code with open and close (to name just two):

use autodie qw/open close/; open my $fh, '<', 'filename'; while (<$fh>) { # Do stuff here } close $fh;

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://756737]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (5)
As of 2020-01-29 11:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?