lstat FILEHANDLE lstat EXPR lstat |
執行相同的測試FILEHANDLE狀態函數或文件所提到的EXPR或$_
如果該文件是一個符號鏈接,它返回的信息的鏈接,而不是它指向的文件。 否則,它返回的信息的文件。
在列表上下文中,它返回一個列表中13種元素,這些個行業如下:
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 owner 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 in seconds since the epoch (*) 11 blksize preferred block size for file system I/O 12 blocks actual number of blocks allocated
注: 時代是在1970年1月1日00:00 GMT。
試試下麵的例子:
#!/usr/bin/perl -w #by www.gitbook.net $filename = "/tmp/test.pl"; ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size, $atime,$mtime,$ctime,$blksize,$blocks) = lstat($filename); printf "File is %s,\n size is %s,\n perm o, mtime %s\n", $filename, $size, $mode & 07777, scalar localtime $mtime;
這將產生以下結果:
File is /tmp/test.pl, size is 202, perm 007, mtime Wed Dec 31 17:00:00 1969