in reply to Parsing text string in Perl

Tom

Does the header 'Time:' always begin each record?

If so, you can set the record delimiter, $/, to the value 'Time:' and then,

{ local $/ = 'Time:'; while(my $record = <$fh>) { # Skip over everything that doesn't have ESME_RTHROTTLED next unless $record =~ /ESME_RTHROTTLED/; # If we made it here, then this is a record that matches. # ... so do something with it ... } }