Call stat function from file handle : stat « File « Perl






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

1.Getting Information on a File
2.Get return value from stat function
3.Get the file size
4.Get the length of a file
5.File statistics returned from the stat command
6.File stats
7.Checks the permissions of a file
8.Lists files in directory; then gets info on files with stat
9.The stat Function for Windows NT File Attributes