in reply to Re: Print Behavior with Carriage Return
in thread Print Behavior with Carriage Return

Did you realize that with the johngg/haukex suggestion, your issue does not need an explanation or solution. It never arises. However, this is only a good idea if your open statement opens only windows files.
Bill
  • Comment on Re^2: Print Behavior with Carriage Return

Replies are listed 'Best First'.
Re^3: Print Behavior with Carriage Return
by haukex (Archbishop) on Jan 05, 2020 at 23:36 UTC
    However, this is only a good idea if your open statement opens only windows files.

    Why do you say this? The :crlf layer doesn't hurt when opening files that have LF only. The following test passes on both Linux and Windows.

      Yes, :crlf processes unix style files correctly, but for the wrong reason. (It does not translate Unix record separators, it fails to recognize them at all. This works because the Unix record separator and the perl newline are the same character.) I find this misleading, and recommend against it.
      Bill
        Yes, :crlf processes unix style files correctly, but for the wrong reason. (It does not translate Unix record separators, it fails to recognize them at all.

        I still don't quite follow - AFAIK, on *NIX, Perl's "logical" \n is always LF, so I don't really see any problems if it's just CRLF vs. LF files and only Windows and *NIX are involved; if there are other OSes or formats involved, then one might indeed run into issues there. But of course I'd also advise to always know one's input format (that gets especially important when Unicode is involved), so knowing whether one's input is CRLF vs. LF is a good recommendation of course. (In this particular case I think the :crlf layer gives more flexibility over input formats.)