Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: Parsing Files for the Interesting Bit

by dws (Chancellor)
on Jul 05, 2004 at 01:03 UTC ( #371768=note: print w/replies, xml ) Need Help??


in reply to Parsing Files for the Interesting Bit

I might do something like:

while ( <FILE> ) { if ( /--- start foo ---/ ) { # we're about to start processing while ( <FILE> ) { last if /--- end foo ---/; # here's a line of stuff to process } # we're done with this block } }

This approach eliminates the conditional, at the risk of not noticing that a file has ended mid block. If that's liable to be a problem, it's a straighforward mod to catch it.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (4)
As of 2021-12-05 03:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    R or B?



    Results (31 votes). Check out past polls.

    Notices?