go ahead... be a heretic | |
PerlMonks |
Re: Re: Re: Searching for variable then blank linesby tstock (Curate) |
on Mar 14, 2002 at 05:54 UTC ( [id://151608]=note: print w/replies, xml ) | Need Help?? |
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
In Section
Seekers of Perl Wisdom
|
|