#!/usr/bin/perl use Archive::Extract; $Archive::Extract::PREFER_BIN=1; #if $inputZip exists unzip, store file correctly and remove date from dekadalGet.txt if (-e $inputZip) { #unzip file print $timeStamp.' -New zip file successfully downloaded, unzipping file: '."\n"."\n"; # create an archive object my $archive = Archive::Extract->new(archive => $inputZip); #extract the contents to the current working directory $archive->extract() or die "Can't extract: " . $archive->error; print $timeStamp.' -New zip file = '.$inputZip.' for '.$j.' successfully unzipped -> deleting file.'."\n"."\n"; #delete the zip file unlink($inputZip) or die "Zip file cannot be deleted."; unless (-e $inputZip) { print $timeStamp.' -New zip file successfully deleted: '."\n"."\n"; }