On 10/18/06, Chris Share <[EMAIL PROTECTED]> wrote:
I've got a question about $| = 1;
...
If I add $| = 1; at the top of the program this fixes the problem and the program runs as expected.
Normally, output is buffered for efficiency; instead of writing each byte at once, output is saved in a buffer. The buffer is automatically flushed under various circumstances, such as end-of-program, or when the buffer gets full. Setting $| to 1 flushes the buffer after each print or printf statement, as you found, so it's much like having no buffer at all. Usually the buffer is flushed whenever the program stops to read input; your system seems to be an exception. Perhaps your perl binary is misconfigured? Or maybe you have a non-Unix system that does I/O differently than most. But what you describe isn't quite the documented behavior. Hope this helps! --Tom Phoenix Stonehenge Perl Training -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>