I think it means that the buffer, when directed to a teminal, is flushed out each newline. As opposed behaviour when the output go to a pipe or to a file that buffer is write to his destination only when it fulls his 4096 (or another fixed size) limit, regardless of newlines.
In fact you can see as the following code does not having newline nor filling the buffer limit, prints its dots all togheter at the end of execution, when the buffer is printed anyway:
perl -e "for (1..10){print qq(.);sleep 1}"
By other hand if you add a newline to the dot, the program prints a dot a second:
perl -e "for (1..10){print qq(.\n);sleep 1}"
You can also force Perl to print out his buffer as soon as possible setting the $| $OUTPUT_AUTOFLUSH ( see perlvar) to something true:
perl -e "$|++;for (1..10){print qq(.);sleep 1}"
When the output is directed to a pipe or to a file, the normal expected behaviour is to print when the buffer is full, in this way optimizing a lot the overall execution. Also in this situation you can profit of $| to flush buffer as soon as possible. You can test this behaviour writing to a tempfile and using tail on that file in another shell window.
As classic read i can address you to Suffering from buffering?
HtH L*
There are no rules, there are no thumbs..
Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.
| [reply] [d/l] [select] |
| [reply] [d/l] [select] |