#!/perl/bin/perl -w use strict; use warnings; use CGI qw/:standard/; use CGI::Carp qw(fatalsToBrowser); use File::Find; use Archive::Zip qw( :ERROR_CODES :CONSTANTS ); # @chunks could be: file1.txt file2.txt file3.txt or more files or just one my ($arch_path, $dir_archive_name, $outname, my @chunks); my $htdocs_out; open $htdocs_out, '>', "$arch_path/$dir_archive_name/$outname"or die $!; foreach my $chunk_file(@chunks){ my $chunk_zip = Archive::Zip->new(); my $chunk_zipped; $chunk_zipped = $chunk_zip->addFile( $chunk_file ); print $htdocs_out $chunk_zipped; } close $htdocs_out or die $!;