#!/usr/local/bin/perl -w my $myfile = "test.gz"; open(IN,"zcat $myfile|") or die "Cannot open file: $myfile\n"; while () { print ($_) if /mymatch/; }