You could: $_main_Message =~ s/(?<!\0x0d)\x0a(?!\0x0d)/\x0d\x0a/g;.
In reply to Re: problem with 'bare LF' in script by GrandFather in thread problem with 'bare LF' in script by powerhouse