http://www.perlmonks.org?node_id=653338


in reply to Parsing a log file

You could do:
@logparts = split /msg=/, $line; $msg_bit = (split / Src/, $logparts[1])[0];
Or do you need the rest of the line split up, too?

Edit: Reading more carefully, I see you do need the rest of it. Still, the above should help you extract the msg= component, and you still have the rest of the pieces. Don't forget that you lose the record separator you use to split on, if that 'msg=' or 'Src' are actually important to your report.