我正在查看一些较旧的 perl 代码,我可以看到有人正在使用以下命令比较目录中各种文件的时间戳:
int(-M $filename);
这到底是做什么的?我查看了文档中的 int()
条目,但找不到有关 -M
标志的任何信息。
最佳答案
那是一个文件测试操作符-X
-X FILEHANDLE
-X EXPR
-X DIRHANDLE
-X
A file test, where
X
is one of the letters listed below. This unary operator takes one argument, either a filename, a filehandle, or a dirhandle, and tests the associated file to see if something is true about it. If the argument is omitted, tests$_
, except for-t
, which testsSTDIN
. Unless otherwise documented, it returns1
for true and''
for false. If the file doesn't exist or can't be examined, it returnsundef
and sets$!
(errno). Despite the funny names, precedence is the same as any other named unary operator. The operator may be any of:... 31. -M Script start time minus file modification time, in days.
关于perl - perl 的 int(-M $file) 有什么作用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24940384/