更新时间:2023-11-11 19:44:58
实际上,正确的写法是:
Actually, the proper way to write this is:
#!/usr/bin/perl
$cmd = 'lsss';
my $out=qx($cmd 2>&1);
my $r_c=$?;
print "output was $out\n";
print "return code = ", $r_c, "\n";
如果没有错误,您将得到一个"0",如果有错误,您将得到一个"-1".
You will get a '0' if no error and '-1' if error.