in reply to regex to add network line-endings if required.

That's great! Now, what have you already tried?

Personally, I would attack the problem through the following two steps:

  1. Remove any line ending, whatever it is. perldoc -f chomp and perldoc perlvar for $/ might be interesting reading for you.
  2. Add \015\012 to the string.
  • Comment on Re: regex to add network line-endings if required.