sub zipfiles { my $path = shift; my $tree_hash_ref = shift; foreach my $file ( keys %$tree_hash_ref ) { $file = "$path$file"; print "DEBUG: zipping $file\n"; my $zip = Archive::Zip->new(); my $file_member = $zip->addFile("$file"); my $fh = IO::File->new( "$file.zip", 'w' ); $fh->binmode; unless ( $zip->writeToFileHandle($fh) == 0 ) { $fh->flush; $fh->close; } $fh->close; print "DEBUG: unlinking $file\n"; unlink($file); } }