Call stat function from file handle
use IO::File;
$filename = 'file.txt';
$filehandle = new IO::File;
$filehandle->open("<$filename") or die "Cannot open $filename";
($dev, $ino, $mode, $nlink, $uid, $gid, $rdev, $size, $atime,
$mtime, $ctime, $blksize, $blocks) = $filehandle->stat;
print "$filename is $size bytes long.";
Related examples in the same category