use Compress::Zlib my $cntlength = length $output; my $header = "Content-Type: text/html\n"; if($ENV{HTTP_ACCEPT_ENCODING} =~ /gzip/oi and $cntlength > 200) {   my $compress = Compress::Zlib::memGzip($output);   my $length = length($compress);   $header .= "Content-Encoding: gzip\n";   $header .= "Content-Length: $length\n";   $output = $compress; }   print "$header\n$output";