【发布时间】:2012-08-25 14:11:19
【问题描述】:
这里有什么问题?
我正在尝试显示现有文件的内容:
perl -MFile::Slurp -e 'print File::Slurp->read_file("/tmp/001.jpg", { binmode => ":raw" } ) if -e "/tmp/001.jpg"; '
我得到了错误:
read_file 'File::Slurp' - sysopen: No such file or directory
文件存在,print 只执行if -e "/tmp/001.jpg"
【问题讨论】:
-
如果没有括号,您对
-e的使用可能会模棱两可。所以,试试if (-e "/tmp/001.jpg") -
带括号的结果相同:|