in reply to zcat pipe gives "gzip: stdout: Broken pipe" error

Unrelated to your problem, but for reliability and security, I would recommend the 3+ argument form of open,

open(MYFILE, "-|", "/bin/zcat", $myfile) || die("ERROR: Cannot open $m +yfile for read: $!\n");

Or better use a lexical scalar,

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

Good Day,
    Dean