When you're on Windows, \n actually means CRLF. So the safest approach is to explicitly split on CRLFNot exactly. The translation happens during reading/writing. Once you have read your file into memory, \n is \x0A on every platform (otherwise, length("\n") would be 2 on Windoze. So my intention was to suppress the translation on writing, by setting the file handle to binmode.
open my $out, '>:raw', $out_filename
I think I will try this; after all, this is a good occasion to get familiar with IO layers in Perl. If it suppresses \n conversion, the s/// won't be necessary. I'll post my findings.
Still, it would be interesting to know why my binmode() did not worked. Is binmode not supposed to be used in that way, or is there a bug in the IO::File::binmode implementation?
In reply to Re^2: Can't get rid of \r
by rovf
in thread Can't get rid of \r
by rovf
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |