in reply to Perl line endings: something broken in ActiveState Perl 5.8?

Qutoe from perldoc perlipc:

Internet Line Terminators

The Internet line terminator is "\015\012". Under ASCII variants of Unix, that could usually be written as "\r\n", but under other systems, "\r\n" might at times be "\015\015\012", "\012\012\015", or something completely different. The standards specify writing "\015\012" to be conformant (be strict in what you provide), but they also recommend accepting a lone "\012" on input (but be lenient in what you require). We haven't always been very good about that in the code in this man-page, but unless you're on a Mac, you'll probably be ok.

Okay... Your question is not IPC-related, but after reading that, Iusually remove line endings with

s/[\015\012]+//g;
So in order to replace them with UNIX Style line endings, this should do:
s/[\015\012]+/\015/g;
Attention! If you have more than one consecutive line ending in your string, they will be reduced to 1...

Update: The problem was not data related but really (Activestate-)Perl related. Sorry for wasting your time ;-)


s$$([},&%#}/&/]+}%&{})*;#$&&s&&$^X.($'^"%]=\&(|?*{%
+.+=%;.#_}\&"^"-+%*).}%:##%}={~=~:.")&e&&s""`$''`"e

Replies are listed 'Best First'.
Re^2: Perl line endings: something broken in ActiveState Perl 5.8?
by rduke15 (Beadle) on Oct 13, 2005 at 07:28 UTC
    this should do:

    Yes it should, but no it doesn't! That's why I came here.

      Ever tried a hexdump of that data? This usually helps me isolating the problem if it's data-related.

      Update: Delete this node. Just noticed after posting that the problem was not data related but really (Activestate-)Perl related. Sorry for wasting your time ;-)


      s$$([},&%#}/&/]+}%&{})*;#$&&s&&$^X.($'^"%]=\&(|?*{%
      +.+=%;.#_}\&"^"-+%*).}%:##%}={~=~:.")&e&&s""`$''`"e