open(MYFILE, "-|", "/bin/zcat", $myfile) || die("ERROR: Cannot open $myfile for read: $!\n"); #### my $fh; if ($myfile =~ /\.gz$/) { open($fh, "-|", "/bin/zcat", $myfile) || die("ERROR: Cannot open $myfile for read: $!\n"); } ...