Corion's suggestion of adding the "binmode" sub to your code is not unreasonable, but if you're new to Perl, the simplest answer for you is just to update the IO::File module. If you've never done that, modern Perls provide a script that makes it easy - it's called 'cpan'. Assuming that you're on some sort of *nix (rather than Windows) and that you have access to root privieleges, all you need to do is run 'cpan' as root at your command line, and follow the setup prompts; once you're done with the setup, just type 'install IO::File' and that'll take care of it.

Just for completeness' sake - on older versions of Perl, where there's no "cpan" script, you'd type "perl -MCPAN -eshell" (again, as root) to do essentially the same thing. This also works on modern versions.


--
"Language shapes the way we think, and determines what we can think about."
-- B. L. Whorf

In reply to Re^4: attachment logging by oko1
in thread attachment logging by Bass-Fighter

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.