in reply to Trouble with Streaming text to STDOUT

This is a classic - you need to unbuffer your STDOUT. Normally, STDOUT is buffered. The long answer on how to do it is in the FAQ, the short answer is:

$old=select(STDOUT); $|=1; select($old);

CU
Robartes-

Replies are listed 'Best First'.
Re: Re: Trouble with Streaming text to STDOUT
by Maelwys (Initiate) on Oct 03, 2002 at 17:58 UTC
    Thanks for the advise, but something still doesn't seem to be working.
    I tried reading over the FAQ entries that you pointed me at, and found the one that you're referring to. But I still can't make it work. I inserted the code you recommended (also found in the FAQ) into the top of my code as it's about to start the streaming output. From what I'd read that should be all I need, to set that to non-buffering for the rest of the program. But it still displays the same characteristics as before. Am I missing something else? Or did I put it in the wrong place, maybe?
    Any advice appreciated.

    Mael
      fglock's node below is pointing in the right direction for that issue. You should be unbuffering SOMEOUT, as you are printing to that filehandle, and not to STDOUT directly. Printing to STDOUT directly would have spared you this gotcha.

      $old=select(SOMEOUT); $|=1; select($old);

      CU
      Robartes-