The conversion, under Windows, from "\r\n" to "\n" happens (only!) when reading from a file that isn't in binmode. It sounds like you are reading these file contents over a socket, which are always in binmode (since you don't want to assume that the system on the other end of that socket is using the same line endings as you). So if the remote system writes "\r\n" into the socket, then Perl will read "\r\n" from that socket.
If it weren't for MacOS's bad design decisions, then this would be fairly easy to deal with. If you don't care about ignoring blank lines, then you can split on /[\r\n]+/ to work around it.
If you don't ever intend to run your code on a Mac, then you can split on /\r*\n|\r/ to handle a wide variety of cases (unfortunately, finding a line ending of "\r\r\n" isn't that hard to do). If you don't even intend to run your code on a non-ASCII system, then you can split on /\cM*\cJ|\cM/ and be happy even if your code is run on a Mac.
- tye (but my friends call me "Tye")In reply to (tye)Re2: line endings in remote documents
by tye
in thread line endings in remote documents
by Amoe
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |