use File::Slurp; $_ = read_file($ARGV[0] // $0); s/<(CR|LF)>/\\<$1\\>/g; # "Escape" existing s/\x0d//g, s/\x0a//g; s/((?:)?)/$1\n/g; # Add real line breaks say;