in reply to Perl line endings: something broken in ActiveState Perl 5.8?
The problem is that there is no \r in the line that perl sees since it is stripped off by the Windows IO libraries. Therefore you can't remove it. And when the line is written back out the \n is replaced with \r\n (again by the IO libraries) so the \r is still in the output file.
You can convince yourself of this with the following one-liner which won't print out any of the lines in file.
The following will work when directed to another file:perl -ne "print if /\r/" file.txt
perl -pe "BEGIN{binmode *STDOUT}" file.txt > file2.txt
This won't work with -i however, probably due to where the binmode occurs in relation to other internal actions on the input and back-up file.
--
John.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Perl line endings: something broken in ActiveState Perl 5.8?
by rduke15 (Beadle) on Oct 13, 2005 at 08:50 UTC | |
by Tortue (Scribe) on Oct 13, 2005 at 10:58 UTC |