in reply to Re: sleep problem !
in thread sleep problem !

Radian and other monks ,

Thanks for all those superb answers. I would like to extend a specail thanks to radian as he/she took time to answer why it happens. Never will I get that doubt again.

Well now after learning from the answer given by you people, I am eager to know without giving local $| = 1; in the following code...
print 'processing'; for (1..5) { print ".\n"; sleep 1; }
it works well.

I tried it out for "\t" it does not flush . Why is such a behaviour ? what is unique about "\n"?

rgrds

prad

Replies are listed 'Best First'.
Re^3: sleep problem !
by Skeeve (Parson) on Sep 23, 2005 at 11:25 UTC
    "\n" is unique in that it finishes a line. I think it's for hysterical...errrmmm...historical reason. When something is printed on a lineprinter there is no use in printing each single char. It would last too long to open the connection, print one character, close the connection...

    So everything gets buffered until the line is full or is said to be full ("\n" sent) and then the buffer gets printed

    $\=~s;s*.*;q^|D9JYJ^^qq^\//\\\///^;ex;print