in reply to grab only if pattern matches previous line

I don't think Tomte's solution is clugy at all (and I really like Albannach's version of it). Another possibility that might work for you, depending on what the data really look like, could go like this:
{ local $/ = "request("; # change the input record separator while (<>) { if ( /^(.+)\s+START_TIME, (.*)/ and $1 ne "BADSTRING" ) { print "$1:$2\n"; } } }
This assumes that the data stream is a series of records that all start with "request(" and have line breaks as indicated in your example (because /(.*)/ does not match a new-line character). But if your data varies from that a bit, it might still be pretty easy to adapt this idea to handle it.

Replies are listed 'Best First'.
Re: Re: grab only if pattern matches previous line
by rje (Deacon) on Jul 10, 2003 at 15:20 UTC
    ++graff, that was exactly what I was thinking. Let Perl grab a whole request at a time and match away.