in reply to Re: more ways to filesize
in thread more ways to filesize
I tend to prefer this:if (-s $file) { my $size = (stat _)[7]; }
because the -s returns the file size in bytes. If you want anything else from stat along with the file size, then check "perldoc -f stat" to recall how stat orders things, and do something like this:my $size = ( -s $file );
And I agree with Jeffa -- perltidy is a Blessing To Us All, because proper indentation is every programmer's friend.my ($mode,$uid,$size,$modtime) = (stat $file)[2,4,7,9];
|
|---|