Interesting question on Stack Overflow: http://stackoverflow.com/q/36667502/176646 The OP is able to print to a file but not to STDOUT or STDERR. strace shows that write is only called when printing to the file. perl -e'print "foo" or die $!' exit code is 9, so print is reporting EBADF. Looking at the 5.14.2 source, I see two places that could be setting this in pp_print: if (!io) { if ( gv && GvEGVx(gv) && (io = GvIO(GvEGV(gv))) && (mg = SvTIED_mg((const SV *)io, PERL_MAGIC_tiedscalar))) goto had_magic; report_evil_fh(gv); SETERRNO(EBADF,RMS_IFI); goto just_say_no; } else if (!(fp = IoOFP(io))) { if (IoIFP(io)) report_wrongway_fh(gv, '<'); else report_evil_fh(gv); SETERRNO(EBADF,IoIFP(io)?RMS_FAC:RMS_IFI); goto just_say_no; } But I can't figure out what would trigger either of these conditions. I tried closing STDOUT before running perl and strace shows write(1, "foo", 3) = -1 EBADF (Bad file descriptor) so it's obviously getting past that point even if STDOUT is closed. Any ideas what could cause this?Thread Next