in reply to Re: Native newline encoding
in thread Native newline encoding

s/[\r\n]+$­//;

I much prefer s/\s*$//; because one should never write new code that causes trailing whitespace to be significant.

be strict in what you output  binmode  $fh, '...:crlf'­;

That seems like something that is quite unlikely to be what one should do. That might make sense when trying to use a Unix system to write a text file that will be used by some MS Windows program(s).

For the most common case, you should replace that 'binmode' code with this code:

- tye        

Replies are listed 'Best First'.
Re^3: Native newline encoding (more liberal)
by Anonymous Monk on May 23, 2012 at 03:54 UTC

    That seems like something that is quite unlikely to be what one should do. That might make sense when trying to use a Unix system to write a text file that will be used by some MS Windows program(s).

    You mean like this exact situation? user wants notepad.exe to open .ini file and for it to work?

    For the most common case, you should replace that 'binmode' code with this code:

    What code?