Gzipping is usually done with mod_gzip or mod_deflate... it handles the nasty details of negotiating the encoding with the client.
Try using this in your .htaccess / httpd.conf:
CompressContent Yes
You can alternatively manually compress the output of your scripts with gzip. There is an example here:
http://www.nntp.perl.org/group/perl.poe/2514
Basically, you need to add appropriate headers, then you pass your response body through gzip, and substitute the compressed output. I think you need to list the Content-Length as the uncompressed length, and you add a header for the compressed length.