use PerlIO::gzip; open( IN, "<:gzip", test1.txt.gz ) or die "open failed\n"; while () { print $_; }