EDIT: I rebooted my WinXP box and now everything works fine. It doesn't make any sense to me that it would be magically fixed. I truly dislike this OS. Sorry for the inconvenience of reading/helping with this. I appreciate the help I've received.


Here's some code:

my $size = -s "myfile.pl";

This returns 24576 bytes, but WinXP reports 26755 bytes (difference of 2179 bytes).

This is being used in Amazon::S3. The problem causes the uploaded file to be about 2kb short, which means I'm missing data. It does this with all non-binary files I try it on, but not the same difference in size. It seems to be correct with all the binary files I've tried.

(stat($filename))[7] returns the same (incorrect) number.

Does anyone have any ideas?

EDIT: After some tests, I'm not sure if there's something wrong with the file itself or what, but writing to a file in Perl and then testing the filesize comes out as one would expect. I've yet to figure out what's going on. In the mean time, I'm just slurping the file and doing what I need to in Perl without -s or (stat())7.


In reply to Filesize (-s) is consistenly reporting too small of size in Win32 by wilsond

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.