my $Path = $_[0];
return "" if(not $Path or not -f $Path);
我正在浏览perl文件,无法理解-f选项的含义 不是什么意思?在perl中-f在if语句中意味着什么?
my $Path = $_[0];
return "" if(not $Path or not -f $Path);
我正在浏览perl文件,无法理解-f选项的含义 不是什么意思?在perl中-f在if语句中意味着什么?
-f
运算符测试其操作数是否是常规文件,而不是目录,符号链接或其他特殊文件。
所有以-
开头的运算符都称为文件测试运算符,并且通常也以shell脚本语言存在。它们是一元运算符(只需一个操作数),如!
或~
是一元运算符。
-r readable
-w writable
-x executable
-o owned by user
-R readable by this user or group
-W writable by user or group
-X executable by this user or group
-O owned by this user
-e File or directory name exists
-z File exists and has zero size
-s exists and has nonzero size (the value is the size in bytes)
-f plain file
-d directory
-l symbolic link
-S socket
非常感谢... – 2012-02-16 09:01:48
[有关文件操作符的详细信息,请参见这里。](http://perldoc.perl.org/functions/-X.html) – Feysal 2012-02-16 08:48:21