use IO::Zlib; #requires Compress::Zlib, of course my $fh = IO::Zlib->new("foo.gz"); while (<$fh>) { go_nuts(); }