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.

So it actually spits a warning the first time.

Where does that warning go? It's not on my screen when I run it. As I see it, $output is uninitialized both times, but the warning is not printed the first time.

I'm confused also because what I pass to open is a reference to $output which is always a real value regardless of whether $output is initialized or not.

Replies are listed 'Best First'.
Re^3: Use of uninitialized value in open second time but not first.
by Bro. Doug (Monk) on Apr 01, 2007 at 16:29 UTC
    I see where I went wrong.

    To give a more concise answer to this question, I got the code to run and saw the results just as you reported. So I started experimenting.

    I noticed there are a lot of operations on references happening here, which makes me leery when you're mucking with global symbols (STDOUT, for instance). So I took $output and gave it persistence in scope:
    our $output ; # changed 'my' to 'our'
    The problem went away.

    By the way, I agree with the monks who suggested using select().

    Peace, monks.
    Bro. Doug :wq