如何使用Perl搜索归档文件
-
02-07-2019 - |
题
使用Perl读取压缩目录内容的首选方法是什么?
解决方案
CPAN上有几个模块用于处理各种存档格式(zip,tar等),你可能会使用的是 Archive :: Zip 。
其他提示
归档::邮编
require Archive::Zip;
my $zip = Archive::Zip->new($somefile);
for($zip->memberNames()) {
print "归档::邮编
<*>\n";
}
如果您需要.tar.gz存档的内容
open(DIR_LISTING, "gzip -dc concert25.tgz | tar -tf -|") || die;
while (<DIR_LISTING>) {
print;
}
close (DIR_LISTING);
不隶属于 StackOverflow