I'm never quite sure whether Perl will start treating input as unicode without a specific request on an open to do so?

None of the default PerlIO layers do any conversions except :crlf.

However, there could be action at a distance (such as from an open pragma).

That's why binmode should be used on file handles containing binary data (such as the OP's compressed file). It avoids any such problem.

For example, does it recognise BOMs in an input stream and act upon them?

:encoding(UTF-16) uses the BOM to determine byte ordering, but something needs to tell open to use :encoding(UTF-16) first.


In reply to Re^4: seek() functionality on pipes by ikegami
in thread seek() functionality on pipes by HKS

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.