Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Re: Re: Searching for variable then blank lines

by tstock (Curate)
on Mar 14, 2002 at 05:54 UTC ( [id://151608]=note: print w/replies, xml ) Need Help??


in reply to Re: Re: Searching for variable then blank lines
in thread Searching for variable then blank lines

yes, it does what I think you want.

$s is true if you found the starting string, false otherwise
$b only gets to 2 if it finds two blank lines in a row
we only end the loop if we found two blank lines ($b) and a start ($s)
we only print if we found a start ($s)

(might make more sense if read from the bottom up, but then it wouldn't work correctly)

This code works for big and small files alike, but for smaller files you can always try a regular expression if it's easier for you. If you don't use the array, this code actually has no memory problems handling very large files.

Tiago
  • Comment on Re: Re: Re: Searching for variable then blank lines

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (2)
As of 2024-04-25 19:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found