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

I think your filesystem may be corrupt, try chkdsk. Also try this test
Q:\>perl -e"open F, q!>!, q!test! or die $!; warn print F q,x, x 2675 +5 ; warn close F;die -s q!test!" 1 at -e line 1. 1 at -e line 1. 26755 at -e line 1. Q:\>dir test 01/17/2009 02:27 AM 26,755 test 1 File(s) 26,755 bytes
  • Comment on Re: Filesize (-s) is consistenly reporting too small of size in Win32
  • Download Code

Replies are listed 'Best First'.
Re^2: Filesize (-s) is consistenly reporting too small of size in Win32
by wilsond (Scribe) on Jan 17, 2009 at 10:49 UTC

    With this test, both the OS and Perl agree that the file is 26755 bytes.

    Writing "x\r\n" produces 107020 bytes, which the OS and Perl agree on.

      heh, You mean writing "x\r\r\n" (by printing "x\r\n"). 107020 / 26755 = 4.

        Hah, yeah... I tried just "\n" as well. In any case, I just wanted to make sure it wasn't a line-ending problem, which it didn't appear to be based on the tests.


        If you want to do evil, science provides the most powerful weapons to do evil; but equally, if you want to do good, science puts into your hands the most powerful tools to do so.
        - Richard Dawkins