However, since the publishing of this book, by many known as "Camel III", the consensus of the naming of this functionality has moved from "discipline" to "layer".
All documentation of this version of Perl therefore refers to "layers" rather than to "disciplines". Now back to the regularly scheduled documentation More details can be found in PerlIO::encoding. Calling binmode normally flushes any pending buffered output data and perhaps pending input data on the handle. An exception to this is the :encoding layer that changes the default character encoding of the handle. Alternative to set file to binary mode: binmode FH ; It's worth understanding what 's' represents for OP : perldoc.
William Pursell William Pursell k 44 44 gold badges silver badges bronze badges. Sign up or log in Sign up using Google. Sign up using Facebook. Sign up using Email and Password.
Post as a guest Name. Email Required, but never shown. The Overflow Blog. Podcast Making Agile work for data science. Stack Gives Back Featured on Meta.
New post summary designs on greatest hits now, everywhere else eventually. When paired with filenames from variables it creates a huge security hole waiting to be exploited. Using lexical filehandles is also good idea it limits the scope of your filehandle. Of course, if you want to use this module, it helps to know some C. Community Bot 1 1 1 silver badge. I am totally going to use this technique.
I don't see anything wrong with it except efficiency. I'm much more interested in solving my problem quickly with comprehensible code than in learning the correct perl way to do it. Thanks for posting.
Honestly, I don't see the problem with this either. Pack may be more efficient, but this is perfectly good code. I use routines like this frequently in C to process known-endian data on unknown-endian platforms. Except with masking and shifts rather than division, since C has stronger typing.
Same concept though. Sign up or log in Sign up using Google. Sign up using Facebook. Sign up using Email and Password. Post as a guest Name. Email Required, but never shown. The Overflow Blog. Podcast Making Agile work for data science. Stack Gives Back Featured on Meta.
New post summary designs on greatest hits now, everywhere else eventually. Visit chat.
0コメント