如何使用 7z 测试?
文件的目录已定义。
我想使用 7z 的“test”命令获取“test”值。
foreach $str0 (glob "*.zip"){
my $test = system( "7z t -y $str0");
print $test;
}
如何获得“7z 测试”值?
编辑:
您的意思是使用 qx 而不是 System 吗?
你的意思是对的吗?
foreach $str0 (glob "*.zip"){
my $test = qx/7z t -y $str0/;
print $test;
}
或者
foreach $str0 (glob "*.zip"){
my $test = `7z t -y $str0`;
print $test;
}
我都尝试了,但无法获得“测试值”。
The directory of the file is defined.
I want to get the 'test' value using the 'test' command of 7z.
foreach $str0 (glob "*.zip"){
my $test = system( "7z t -y $str0");
print $test;
}
How can I get the '7z test' value?
Edit:
Do you mean to use qx instead of System?
Is it right that you meant it?
foreach $str0 (glob "*.zip"){
my $test = qx/7z t -y $str0/;
print $test;
}
or
foreach $str0 (glob "*.zip"){
my $test = `7z t -y $str0`;
print $test;
}
I tried both, but I can't get the 'test value'.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在 Perl 中至少有三种方法可以做到这一点:
qx
和反引号方式基本上是相同的,除了使用qx
时,您可以选择使用什么分隔符来开始/结束字符串。使用'
作为分隔符可防止变量插值。第三种方法是使用
open
打开 7zip 的管道。There are at least three ways to do this in Perl; the
qx
and backticks ways are basically the same thing, except withqx
you have a choice of what delimiter to use to start/end the string. Using'
as the delimiter prevents variable interpolation.The third way is using
open
to open a pipe to 7zip.