open my $fh, "gunzip -c $input_file |" and !eof($fh) or die "$!/$?"; while(<$fh>){ ... }