in reply to Re: Use of uninitialized value in open second time but not first.
in thread Use of uninitialized value in open second time but not first.

Thanks for the suggestion!

I actually don't know whether the code whose output I want to capture specifically prints to STDOUT (I didn't write it). I thought of the select solution too, but then I thought, "but what if it writes directly to STDOUT?" So I did this.

The solution I had actually works but produces the warning. I mention the "real" problem just in case I'm doing something brainless.