in reply to Reading contents of a zip file without opening it

Here's a bit of code mangled for your purpose from a hunk of working code from an old project. It should run as-is or with a tweak or two.
#!/usr/bin/perl -w use strict; use Archive::Zip; my $zfile = 'somefile.zip'; my $zipobj = Archive::Zip->new() or die "Can't create zip object\n"; if ($error = $zipobj->read($zfile) ) { die "Can't read $zfile\n"; } my @file_names = $zipobj->memberNames();
I recommend Archive::Zip. It's pretty straightforward and capable once you get the concept of the way it returns zipped archive members as objects which you then call other methods to read or manipulate. For example (from the same project):
my @file_objs = $zipobj->members(); for my $file_obj (@file_objs) { my $file_txt = $file_obj->contents(); # etc. etc. }
Cheers. Hope this helps. David

Replies are listed 'Best First'.
Re^2: Reading contents of a zip file without opening it
by Anonymous Monk on Dec 30, 2015 at 06:53 UTC
    Thanks David for sharing, This works fine for me.