in reply to Can't get rid of \r
So the safest approach is to explicitly split on CRLF aka \x0D\x0A (or set $/ to that) and to explicitly join on LF aka \x0A.
I'd do something like this:
open my $in, '<:raw', $in_filename or die ...; open my $out, '>:raw', $out_filename or die ...; while (<$in>){ s/\x0D\x0A\z/\x0A/; print $out $_; } close $in or die ..; close $out or die ... ;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Can't get rid of \r
by rovf (Priest) on Sep 11, 2008 at 15:59 UTC |