in reply to Re^2: detecting non-zero exit code when opening from a pipe
in thread detecting non-zero exit code when opening from a pipe

Of course it didn't trap at the open statement. The error hasn't happened yet. As for the incorrect error message, the code should be:

... if (!close($fh)) { $! and die("Can't close gunzip: $!\n"); ($? & 0x7F) and die("gunzip died from signal ", ($? & 0x7F), "\n"); ($? >> 8) and die("gunzip exited with error ", ($? >> 8), "\n"); }
gzip: notexists.gz: No such file or directory gunzip exited with error 1