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
In reply to Re^2: Native newline encoding (more liberal)
by tye
in thread Native newline encoding
by salva
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |