February 2012
Intermediate to advanced
1184 pages
37h 17m
English
statFILEHANDLEstatDIRHANDLEstatEXPRstat
In scalar context, this function returns a Boolean value that
indicates whether the call succeeded. In list context, it returns a
13-element list giving the statistics for a file, either the file opened
via FILEHANDLE or DIRHANDLE, or named by
EXPR. It’s typically used as follows:
($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,
$atime,$mtime,$ctime,$blksize,$blocks)
= stat $filename;Not all fields are supported on all filesystem types; unsupported fields return 0. Table 27-6 lists the meanings of the fields.
Table 27-6. Fields returned by stat
| Index | Field | Meaning |
|---|---|---|
| 0 | $dev | Device number of filesystem |
| 1 | $ino | Inode number |
| 2 | $mode | File mode (type and permissions) |
| 3 | $nlink | Number of (hard) links to the file |
| 4 | $uid | Numeric user ID of file’s owner |
| 5 | $gid | Numeric group ID of file’s designated group |
| 6 | $rdev | The device identifier (special files only) |
| 7 | $size | Total size of file, in bytes |
| 8 | $atime | Last access time in seconds since the epoch |
| 9 | $mtime | Last modify time in seconds since the epoch |
| 10 | $ctime | Inode change time (not creation time!) in seconds since the epoch |
| 11 | $blksize | Preferred blocksize for file system I/O |
| 12 | $blocks | Actual number of blocks allocated |
$dev and $ino, taken together, ...
Read now
Unlock full access