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

As I've said several times now, to be completely accurate (which is important here), on Windows and *NIX, the Perl string "\n" means "\x0A"

That is not completely correct.
When using Perl's default I/O layer, print "\n" will emit <LF> on Unix and <CR><LF> on Windows.

When reading a text line (Unix or Windows), the <CR> will be deleted, if it exists.
Update: When using "standard default I/O methods"

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

Replies are listed 'Best First'.
Re^13: How do I display only matches
by haukex (Archbishop) on Sep 28, 2019 at 07:54 UTC
    When using Perl's default I/O layer, print "\n" will emit <LF> on Unix and <CR><LF> on Windows.

    Yes, you're just repeating back to me what I said several times now.

    When reading a text line (Unix or Windows), the <CR> will be deleted, if it exists.

    For *NIX that is once again wrong.

    $ hexdump -C test.txt 00000000 46 6f 6f 0d 0a |Foo..| $ perl -wMstrict -MData::Dump -e 'dd <>' test.txt "Foo\r\n"
    Update: When using "standard default I/O methods"

    But that's not the only thing this discussion iswas about. It's also about you insisting that (essentially) $ matches before \r, insisting that (essentially) "\n" eq "\r\n" and that somehow all network communication magically uses CRLF, or stuff like the above. Sorry, but all the evidence appears to point to a fundamental misunderstanding of the topic.

    That is not completely correct.

    Are you just trolling now? You clearly still haven't studied the subject matter enough, I'm not sure if you're even reading my posts, and I'm tired of repeating myself and running tests that you could be running, so for now, I'm out.

      At this point, I need to get a Unix account and run some tests and compare Windows vs Unix. This will take some weeks.

      I did look at Re^7: How do I display only matches and I am perplexed.

      Somehow, print $sock "foo\n\0\0"; produces 66:6f:6f:0a:00:00. On both Windows and Unix? That does indeed surprise me! But, if true, that does indeed indicate that on Windows, printing to a socket is different than printing to a file.

      let's stop this subthread. I will investigate further.