in reply to can not flush stdout

First, you should have a look at the first reply on your node. I think there's some valuable information in there.

Second, I'm glad you at least put <CODE> tags around your code but a little more layout won't hurt. For example: just use white lines to separate the parts of code (variable initialisation and different parts of the real code) :) This is not meant to assault you in any way, it's just offered as an advice.

Thirth thing, think about what you're actually trying to achieve. For example:
my $old_fh=select(STDOUT); $| = 1; select($old_fh);
default, STDOUT is selected. So, $old_fh refers to STDOUT now. Then you select STDOUT and make it to flush automatically. Then, you select $old_fh which refers to STDOUT. I really had a hard time while trying to understand what you was actually trying to do here.
Again, not trying to assault you, but what you're doing here is just: $| = 1 in three lines, where the other two lines only are like "Hey MUBA, what is your nick name?".




"2b"||!"2b";$$_="the question"

Replies are listed 'Best First'.
Re^2: can not flush stdout
by Anonymous Monk on Jul 11, 2004 at 07:49 UTC
    Thanks for all the advice. I've always appreciated how constructive the criticism is here...i in no way took that as an assault. That bit of code to which you referred kept being repreated in every article I found on unbuffering output. It was usually written for file handles other than STDOUT, but since nothing else i'd tried had worked (thanks to '-p') I tried it. It did look odd to me, but "all the articles were doing it". Now, that I've taken out the -p, I'll rip out the superfluous lines as well.