NAME

stat - get a file's status information


SYNOPSIS

stat FILEHANDLE

stat EXPR

stat


DESCRIPTION

Returns a 13-element array giving the status info for a file, either the file opened via FILEHANDLE, or named by EXPR. If EXPR is omitted, it stats $_. Returns a null list if the stat fails. 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. Here are the meaning of the fields:

  dev	    device number of filesystem 
  ino	    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 (special files only)
  size	    total size of file, in bytes 
  atime	    last access time since the epoch
  mtime	    last modify time since the epoch
  ctime	    inode change time (NOT creation time!) since the epoch
  blksize   preferred block size for file system I/O
  blocks    actual number of blocks allocated

(The epoch was at 00:00 January 1, 1970 GMT.)

If stat is passed the special filehandle consisting of an underline, no stat is done, but the current contents of the stat structure from the last stat or filetest are returned. Example:

    if (-x $file && (($d) = stat(_)) && $d < 0) {
	print "$file is executable NFS file\n";
    }

(This works on machines only for which the device number is negative under NFS.)