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

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.

Replies are listed 'Best First'.
Re^17: How do I display only matches
by jcb (Parson) on Oct 02, 2019 at 23:31 UTC

    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.

        I must have forgotten that part because I did not understand "those weird colon things" at the time. :-)

        Were I/O layers still being called "disciplines" at the time? I still have very little idea of what a "line discipline" is supposed to do in POSIX, although I suspect that it has something to do with the CRLF translations that occur on terminal devices.