perl 怎么解压文件

cups_book 发布于 2013/08/28 15:02
阅读 1K+
收藏 0
perl怎么解压zip文件?

以下是问题补充:

@cups_book:就是说如何利用archive-zip来解压zip文件? Window平台下的Active Perl, 版本是5.12 (2013/08/28 15:11)
加载中
0
cups_book
cups_book

下面这么写有什么问题呢?

出来到结果怎么不对呢?

D:\perl_test\arc_zip>perl arc_zip.pl
Set up gcc environment - 3.4.5 (mingw-vista special r3)
D:\perl_test\arc_zip\zip_files/a.zip
D:\perl_test\arc_zip\zip_files/b.zip
D:\perl_test\arc_zip\zip_files/c.zip
D:\perl_test\arc_zip\zip_files/.
D:\perl_test\arc_zip\zip_files/..

D:\perl_test\arc_zip>


#!/usr/local/bin/perl -w

use Archive::Extract;

$dir = "D:\\perl_test\\arc_zip\\zip_files";
@files = <$dir/* $dir/.*>;
foreach(@files){
	print $_."\n";
}

0
cups_book
cups_book

change to below, it is ok, leave here for coming beginner

#!/usr/local/bin/perl -w

use Archive::Extract;

my $ae;
my $ok2;
$dir = "D:\\perl_test\\arc_zip\\zip_files";
@files = <$dir\\* $dir/.*>;
foreach(@files){
	if(-f $_){
		## build an Archive::Extract object ###
		$ae = Archive::Extract->new( archive => $_ );
		## extract to /tmp ###
		$ok2 = $ae->extract( to => 'D:\\perl_test\\arc_zip\\ext_files' );
	}
}



#!/usr/local/bin/perl -w

use Archive::Extract;

$dir = "D:\\perl_test\\arc_zip\\zip_files";
@files = <$dir\\* $dir/.*>;
foreach(@files){
	if(-f $_){
		print $_."\n";		
	}
}
返回顶部
顶部