views:

300

answers:

3

What is your preferred method for reading through the contents of zipped directories with Perl ?

+5  A: 

There are several modules on CPAN for working with various archive formats (zip, tar, etc.), the one you're probably after is Archive::Zip.

Kyle Burton
When you post links to (search.)CPAN, please make sure you point to the author and version agnostic URL so it always points to the latest version of the module. In this case, that would be: http://search.cpan.org/perldoc?Archive::Zip
tsee
+1  A: 

If you want the contents of a .tar.gz archive

open(DIR_LISTING, "gzip -dc concert25.tgz | tar -tf -|") || die;
while (<DIR_LISTING>) {
   print;
}
close (DIR_LISTING);
David Nehme
+2  A: 

Archive::Zip

require Archive::Zip;
my $zip = Archive::Zip->new($somefile);
for my $m ($zip->memberNames()) {
  print $m;
}
Jeff MacDonald