if (-e $zip_path) { unless ( $zip->read( $zip_path ) == AZ_OK ) { die "$zip_path read error.\n"; } print "read $zip_path\n"; } else { die "Error: $zip_path should have just been created."; } # copy those from dir to zip. foreach (@files2copy) { die "File missing: $dir$_" unless -e "$dir$_"; unless ( $zip->addFile( "$dir$_" , $_ )){ die "couldn't add $dir$_ to $zip_path."; } } unless ( $zip->overwrite() == AZ_OK ) { die "$zip_path write error"; }