Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在使用rm通过 Perl 脚本从目录中删除一些文件,但它会引发错误 can't exec "rm" no such file or directory。
can't exec "rm" no such file or directory
命令是这样的:
system("rm $directory$files"); $directory$files = /var/spool/mqueue/qf*
Perl 有一个用于删除文件的内置函数,unlink. 第三个示例显示了如何结合使用它glob来删除文件列表:
unlink
glob
unlink glob "*.bak";
或者在你的情况下,
unlink glob($directory.$files);