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

Accurate wording is important.

We both agree that "\n" prints something different under Unix than on Windows.

No. What gets written to a handle by a print "\n" can be the same on both platforms, or different, depending on which I/O layers are in effect.

I further claim that all network communication uses <CR><LF> as the transmitted line ending. You do not believe that.

No, I didn't say that either. You claimed that "no matter what the OS platform, when writing to a network socket, "\n" means <CR><LF>", which I proved to be incorrect. This is completely separate from the fact that many network protocols do indeed use CRLF as their standard line ending (Update: and certainly not "all" network protocols use CRLF).

I am curious what these nulls mean? "foo\n\0"\0

I added the \0s for two reasons: the server is hard-coded to expect five bytes, and I wanted to make sure that the client always sends at least that many bytes, second, I wanted it to be clear that the server isn't reading too few bytes and cutting off something relevant. The \0 after the quote is AFAIK Perl's way of saying the string is null-terminated (ASCIIZ).

Replies are listed 'Best First'.
Re^10: How do I display only matches
by Marshall (Canon) on Sep 28, 2019 at 04:28 UTC
    No. What gets written to a handle by a print "\n" can be the same on both platforms, or different, depending on which I/O layers are in effect.

    I don't have any quibble about that. I was just talking about what Perl will do by default on various platforms. Perl is one of the most amazingly configurable languages that I've ever worked with. If it normally "barks" and you want it to "meow", it can do that!

    As far as network sockets go, I need to gain access to a Unix machine for testing. Again we are talking about default print statements of strings without any special I/O layer being specified or writing binary to the socket.

    I think that it is fair to say that this whole line ending subject is complicated. There are a lot of "yeah but's".

      As far as network sockets go, I need to gain access to a Unix machine for testing.

      I use VirtualBox. But in this case, I already ran my tests on both OSes - I even highlighted that.