note
bart
I seriously doubt if comparing to \*STDOUT will do. After all, a filehandle is a special entry in a typeglob, it's not just a plain scalar that you can compare. It's not even a reference.
<p>But you can always use [doc://fileno], and applying the snippet of code on the page, you can do:
<c>
if(fileno($fh)==fileno(STDOUT)) {
# ...
}
</c>
<p>And yes, <c>fileno(STDOUT)</c> is allowed by [doc://strict].
<p>There could be a bit of a problem if <c>$fh</c> is a tied filehandle instead of a physical handle. In that case, [doc://fileno] will return -1, which is different from the <em>default</em> value for STDOUT, which is 1. If you tie STDOUT too, then you're in trouble.
1011032
1011032