in reply to regex die?
This seems to be what you want, albeit not very clever - it will fail if the message contains the word "at". :)
use warnings; use strict; while (<DATA>) { my ($msg, $line) = /((?:(?!\bat\b).)*)(.*)/; print "$msg\n $line\n"; } __DATA__ This is my text at noname2.pl line 4.
Prints:
This is my text at noname2.pl line 4.
|
|---|