Perl dummy here. I need to use Compress::Zlib > DEFLATE to write the contents of an array i.e "@data" to a .gz file. Been reading the syntax but I'm little lost. Can the $output be a .gz file. Anyone with any suggestions greatly appreciated.
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
This script, gzstream, does the opposite of the gzcat script above. It reads from standard input and writes a gzip file to standard output.
use Compress::Zlib ;
binmode STDOUT; # gzopen only sets it on the fd
my $gz = gzopen(\*STDOUT, "wb")
or die "Cannot open stdout: $gzerrno\n" ;
while (<>) {
$gz->gzwrite($_)
or die "error writing: $gzerrno\n" ;
}
$gz->gzclose ;