You want to use the gzopen() function to open a .gz file. Compress::Zlib has two interfaces, one to do the deflate compression and one to read gzip files. You are using the deflate functions and trying to pass deflate() the name of the file. The only problem with the gzip interface is that it uses its own function names instead of creating a standard handle object. PerlIO in Perl 5.8 supposedly has a builtin filter to read gzip files.
my $gz = gzopen($file);
my $line;
while ($gz->gzread($line)) {
}
$gz->gzclose();