in reply to Difference between using \r\n and \n on Linux and Windows machines

Use the same version as on Linux, on Windows. The output layer for the file handle FH will, when in text mode (i.e. when binmode hasn't been used on it, like here) convert every "\n" character to the CR+LF sequence — or, like you typed, "\r\n", at least on Windows and Linux, as this notation isn't very portable.

So, if you insert a "\r" character yourself, you will end up with two because perl inserts one itself next to the "\n". So don't do that.

p.s. If you want to create a Unix text file on Windows, you can do

binmode FH;
before you print anything to it, and this conversion is prevented, you'll get an identical result on Windows as on Linux.
  • Comment on Re: Difference between using \r\n and \n on Linux and Windows machines
  • Download Code