How to search archive files using Perl

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

+3
source share
3 answers

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

+6
source

Archive :: Index

require Archive::Zip;
my $zip = Archive::Zip->new($somefile);
for($zip->memberNames()) {
  print "$_\n";
}
+4
source

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

open(DIR_LISTING, "gzip -dc concert25.tgz | tar -tf -|") || die;
while (<DIR_LISTING>) {
   print;
}
close (DIR_LISTING);
+1
source

Source: https://habr.com/ru/post/1697524/


All Articles