binmode basically disables :crlf and :encoding.
Since neither were used in the second snippet, we're talking about the default layers from the OS, from $ENV{PERLIO} or from use of the open pragma.
While using binmode to remove any default :encoding may be smart, it may accidentally disable the :crlf layer. There's no indication that we want the :crlf status to be different, so it's better to use the last snippet if you're dealing with a text file.
Now, if you're dealing with a binary file, you'd use binmode, and you'd use encode for the text bits. Any LF<->CRLF conversion will have to be handled manually.
|