in reply to what does '$| = 1' mean?

On a practical level for beginners, it means:
Dont' buffer STDOUT.
Normally when your program outputs data, it waits
for 2k worth of data to accumulate, before printing.
When you set $|=1;  the program will output any data
immediately, without buffering. This is very useful in cgi. 

For a little example of what this means in a real program:
#!/usr/bin/perl #without a newline, it won't print #until the buffer is 2k #$|=1; # try it with and without this line :-) while (1){ print 'aaaaaa'; select(undef,undef,undef,.03); }

Replies are listed 'Best First'.
Re: Re: what does '$| = 1' mean?
by virtualsue (Vicar) on Aug 11, 2002 at 17:55 UTC

    On a practical level for beginners, it means:
    Don't buffer STDOUT.

    Well, yeeeessss. Buffering is still happening. It's just that setting $| to true asks for the buffer to be emptied after each output command (print, printf, etc) rather than wait until a newline or a full buffer is encountered.