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

You are wrong. The binmode FILEHANDLE operator in Perl is a no-op on POSIX, just as the binary mode option to fopen(3) is a no-op on POSIX. I said this was a portability problem, and it is a portability problem, but programs that never use binmode will handle binary data just fine on POSIX. They will fail on other systems where text and binary streams are actually different.

Replies are listed 'Best First'.
Re^16: How do I display only matches
by haukex (Archbishop) on Oct 02, 2019 at 08:03 UTC
    The binmode FILEHANDLE operator in Perl is a no-op on POSIX

    Sorry, no - it still removes any non-default layers that may be present on the filehandle. Even a handle opened with the default open my $fh, '<', ... can have layers other than the normal defaults present due to the PERLIO environment variable or the open pragma.

      So it is now equivalent to binmode FILEHANDLE, ':raw'? Point accepted, although it was a no-op when I learned Perl in the 5.6 era and seems to remain so absent the special configuration that you mention.

      None of my scripts omitting binmode on POSIX have blown up, but I do not have PERLIO set nor do those scripts use open. (Nor will those scripts ever be distributed in their current forms, as I know that they are not portable.)

        although it was a no-op when I learned Perl in the 5.6 era

        True, although I think that pre-5.8 knowledge is the source of much of the misinformation in this subthread - that's when PerlIO was made the default. (OTOH, interestingly, the relevant parts of the section Newlines in perlport has remained pretty much unchanged since its introduction about 20 years ago in 5.005.)

        So it is now equivalent to binmode FILEHANDLE, ':raw'?

        Well, to be nitpicky, it always was documented to be so, since the second argument was introduced in v5.6.