Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hi, Which is the easiest method to unzip a file in perl? Thanks, Siji

Replies are listed 'Best First'.
Re: Unzipping a file perl
by LanX (Saint) on Dec 27, 2012 at 04:18 UTC
      Yes googling goes a long way. You could use Archive::Extract if your aim is to only extract files. You code would look like this:
      use Archive::Extract; ### build an Archive::Extract object ### my $ae = Archive::Extract->new( archive => 'foo.tgz' ); ### extract to /tmp directory ### my $ok = $ae->extract( to => '/tmp' ) or die $ae->error; ### get files from the archive ### my $files = $ae->files;

      If you're doing more than just extraction then look at Archive::Zip

Re: Unzipping a file perl
by Khen1950fx (Canon) on Dec 27, 2012 at 07:56 UTC
    The easiest way that I know is Archive::Unzip::Burst.
    #!/usr/bin/perl use strict; use warnings; use Archive::Unzip::Burst 'unzip'; unzip("somezip.zip,", "/path/to/targetdirectory");