在 Perl 5 中,您可以使用stat
来获取文件的访问、修改和更改的时间戳。
例如:
my $filename = "sample.txt";
my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,
$atime,$mtime,$ctime,$blksize,$blocks)
= stat($filename)
print "File '$filename' was last accessed $atime seconds since the epoch.\n";
结果是:
File 'sample.txt' was last accessed 1431707004 seconds since the epoch.
如何在 Perl 6 中检查文件时间戳?