if ($myfile =~ /\.gz$/) { open(MYFILE, "/bin/zcat $myfile |") || die("ERROR: Cannot open $myfile for read: $!\n"); } else { open(MYFILE, "$myfile") || die("ERROR: Cannot open $myfile for read: $!\n"); } my $myfile_timestamp = (stat(MYFILE))[9]; close(MYFILE); #### gzip: stdout: Broken pipe #### gzip: stdout: Broken pipe Can't close filehandle 'MYFILE': '' at myscript.pl line 1014 #### while () { chomp($_); }