use PerlIO::gzip; open FOO, "<:gzip", "file.gz" or die $!; print while ; # And it will be uncompressed... binmode FOO, ":gzip(none)" # Starts reading deflate stream from here on