The stat function gets a host of information about a file:
($dev, $inode, $mode, $nlink, $uid, $gid, $rdev, $size, $atime,$mtime, $ctime, $blksize, $blocks) = stat(file);
The file can be either a file handle referring to a file you've opened or a file name.
The stat function returns a list.
The values returned from the stat function are listed in the following table.
The time values are returned as seconds from January 1, 1970.
If you don't have permission to read the file, lstat and stat will return an empty list.
$dev Device number of file system.
$inode Inode number.
$mode File mode (type and permissions).
$nlink Number of hard links to the file.
$uid Numeric user ID of file's owner.
$gid Numeric group ID of file's owner.
$rdev The device identifier device (special) files only.
$size Total size of file, in bytes.
$atime Time of last access.
$mtime Time of last modification.
$ctime Time of inode change.
$blksize Preferred block size for file system I/O.
$blocks Actual number of blocks allocated.