http://www.perlmonks.org?node_id=853999


in reply to problem with Archive::Zip

I fixed a few mistakes. Here's what I came up with. Compare it to your script, and you'll see the mistakes.
!/usr/bin/perl use strict; use warnings; use Archive::Zip qw( :ERROR_CODES :CONSTANTS ); my $file1 = '/root/Desktop/abc.pl'; my $file2 = '/root/Desktop/dodah.zip'; my $zip = Archive::Zip->new(); my $file_member = $zip->addFile($file1, 'copy_log'); $file_member->desiredCompressionMethod( COMPRESSION_STORED ); unless ( $zip->writeToFileNamed($file2) == AZ_OK ) { die 'write error'; }