#! /usr/bin/perl -w use strict; use Compress::Zlib; print "Content-Type: text/plain\n"; $ENV{HTTP_ACCEPT_ENCODING} ||= ''; if ( $ENV{HTTP_ACCEPT_ENCODING} =~ /gz/ ) { print "Content-encoding: gzip\n\n"; my $gz = gzopen ( \*STDOUT, "wb" ); $gz->gzwrite ( "I'm compressed" ); } else { print "\n"; print "I'm not compressed\n"; } __END__