我在Perl中使用了一些系统命令.
在下面的例子中,我获得如下输出:
ls: import-log.*: No such file or directory ls: error-log.*: No such file or directory No specified files found for deletion
我的代码:
sub monthoryear() { @importlog = `ls -al import-log.*`; @errorlog = `ls -al error-log.*`; }
ls: import-log.*: No such file or directory & ls: error-log.*: No such file or directory
解决方法
@H_301_17@ 您可以在subshell命令中添加stderr重定向:@importlog = `ls -al import-log.* 2>/dev/null`; @errorlog = `ls -al error-log.* 2>/dev/null`;