in reply to Re: Perl line endings: something broken in ActiveState Perl 5.8?
in thread Perl line endings: something broken in ActiveState Perl 5.8?

Amazing! Yes, you are right. Searching on my hard drive, I also found ActivePerl 5.003_07, the non-Activestate GS Perl 5.004_02 , and even the DOS port 5.003_93. None of them seem to work, even binmode'ing everything.

perl -i.bak -ne "BEGIN{binmode STDIN; binmode STDOUT}; s/\x0D//;"

It is true that I mostly used this in Linux, but I'm still surprised that I would never have noticed after all these years. Has this never been reported as a bug?
  • Comment on Re^2: Perl line endings: something broken in ActiveState Perl 5.8?
  • Download Code

Replies are listed 'Best First'.
Re^3: Perl line endings: something broken in ActiveState Perl 5.8?
by Tortue (Scribe) on Oct 13, 2005 at 10:58 UTC
    You can get Perl to see the \r on input by setting the PERLIO environment variable to :raw.
    set PERLIO=:raw perl -ne "print if /\r/" file.txt [displays lines]
    This also allows you to write to text files without getting \r inserted. But it still doesn't solve the -i problem. Which kinda looks like a bug.