if (-s $file) { my $size = (stat $file)[7];
That would be better written as: my $size = -s $file;
See perlfunc for documentation of the fact that -s returns the size of the file (in bytes.)
Update: (Answering Chmrr's reply below...)
my $size = -s $file; if ($size) { . . . }
-sauoq "My two cents aren't worth a dime.";
In reply to Re: more ways to filesize
by sauoq
in thread more ways to filesize
by d4vis
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |