in reply to Re^4: How do I display only matches (updated)
in thread (SOLVED) How do I display only matches

Hi BillKSmith,

I can see that there is a need for a FAQ on line endings.
I'd be willing to cooperate with you on such a project?

There are various cases involving reading a Unix file on Windows, reading Windows file on Unix.
Other demos should include that <CR><LF> as standard network protocol.
I have never used binmode to account for \r (<CR>). there are other ways.

Any combine our ways together to make a FAQ?

Update: I see that there are some detailed explanations of :CRLF layer, etc.
A simple "how to" for reading and writing Mac,Unix,PC files on any of the platforms could be helpful.

  • Comment on Re^5: How do I display only matches (updated)

Replies are listed 'Best First'.
Re^6: How do I display only matches (updated)
by BillKSmith (Monsignor) on Sep 26, 2019 at 14:34 UTC

    A FAQ sounds like a good idea to me. I have no idea of the mechanics of how to create one. A FAQ is usually little more than an example of "how to...". That seems to be appropriate in this case. The more detailed discussion that you proposed belongs somewhere else, perhaps a tutorial.

    I suspect that Perl's concept of 'layers'(with appropriate defaults) works so well that most of us are not even aware that it exists. I had used perl for over fifteen years before I even read 'PerlIO'. (I still have not read all the documentation for open.) The issue came up when Laurent_R and I were helping someone on the old PerlGuru.com. We could use his help.

    Bill
      Yes, there appears to be quite a controversy about what print "\n"; means when using the defaults on various platforms.

      Perl's behaviour for me is easy to understand for write: a)Old Mac <CR>, b) Unix <LF>, c) Windows <CR><LF>.

      I believe that when writing to a network socket, <CR><LF> is used, whether a), b), or c).

      For the most part Perl hides these details (except when it doesn't).
      That there is such controversy about such a seemingly simple thing implies that a FAQ is needed.

        Yes, there appears to be quite a controversy about what print "\n"; means when using the defaults on various platforms.

        What exactly is "controversial" here? The facts of how Perl behaves are pretty well established.

        I believe that when writing to a network socket, <CR><LF> is used, whether a), b), or c).

        I already proved that is incorrect (Update: at least for *NIX and Windows).