in reply to Compress::Zlib : what to do with the "in memory" data ?

I believe you need to use the gzopen function, instead of open to put the right header and stuff needed to make it a .gz file.
#!/usr/bin/perl use Compress::Zlib; use strict; # see also the source to Tie::Gzip which demonstrates # (un)gzip using Compress::Zlib if installed. foreach my $f ( grep { -f } @ARGV ) { my ( $buffer, $gz ); if ( $f =~ /gz$/ ) { ( my $rtf = $f ) =~ s/(.)gz$//; open OOT, ">$rtf" or die "$0:$rtf:$!"; binmode OOT; $gz = gzopen( $f, "rb" ) or die "$0:$gzerrno:$!"; print OOT $buffer while $gz->gzread($buffer) > 0; die "$f: $gzerrno:$!" if $gzerrno != Z_STREAM_END; $gz->gzclose(); close(OOT); } else { # gzip our file open COOT, "$f" or die "$0:$f:$!"; binmode COOT; $gz = gzopen( "$f.gz", "wb" ) or die "$0:$gzerrno:$!"; while (<COOT>) { $gz->gzwrite($_) or die "$f.gz,$gzerrno:$!"; } $gz->gzclose; } }

I'm not really a human, but I play one on earth. flash japh