Oh, I just knew I wasn't being as helpful as I thought.

"Of course you can use regular file operators on a binmode file" I said as I slapped myself silly reading your reply. "Why, I've done it a hundred times myself!" And I'd forgotten about how useful the input record seperator can be, especially setting it to undef. I think that using

$/=\<a number>;
would have made things a lot easier sometimes too.

I have fallen prey to the fallacy of assuming that my habit is actually a recommended practice. When I'm dealing with a "binary file" I almost always use read, which makes it clear to me later what I was intending to do with it. On that somewhat flimsy notion, I beg forgiveness for misleading comments.

I have spent a couple of hours attempting to recreate problems I could swear I have had with null bytes (\x0) in files but have been unable to do -- please ignore that part of my answer as well.


In reply to Re: Re: Re: perl in DOS woes by scholar
in thread perl in DOS woes by manzico

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.