use IO::Compress::Zip qw(zip $ZipError); my $zip = new IO::Compress::Zip \*STDOUT or print STDERR "IO::Compress::Zip failed: $ZipError\n"; foreach my $file (@files) { ... do some stuff to the file ... now add file to the archive } $zip->close; #### ## when using '-', Stream is set to 1 my $z = new Archive::Zip::SimpleZip '-', or print STDERR "Cannot create zip file: $SimpleZipError\n"; foreach my $file (@files) { ... do some stuff to the file my $fh = $z->openMember(Name => ""); print $fh ; close($fh); } $z->close;