use Archive::Zip qw(:ERROR_CODES :CONSTANTS); my $zip = Archive::Zip->new(); $fileToAdd = '12345678.pdf'; # ...etc... # ...etc... # ...etc... $fileWithPath = "$viewBillPath\\$fileToAdd"; $zip->addFile($fileWithPath) or die "couldnt add $viewBillPath\\$fileToAdd\n";