Thanks for pointing out the error.

The distinctions among read, sysread, and getc are useful, but any of them serve to point out the issue in the original node. I used read specifically because it is more flexible than getc and does interact properly with buffering if there is any. That may be preferable in some situations, but sysread may be preferable if bypassing buffers is desired as a rule.

As an aside, although there is for perl 5.10.1 and 5.12.0 a note at the bottom of the entry for sysread in the perldocs about UTF and characters, the documentation for read is clearer at a glance about handling characters and not just bytes. That's not anything against the function, and it will probably be fixed in the docs at some point. It's worth noting if you're pointing the function out to people in the meantime, though, because you might want to mention that note stuck at the bottom of the entry.


In reply to Re^5: Nested line buffered output by mr_mischief
in thread Nested line buffered output by Anonymous Monk

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.