Scarborough has asked for the wisdom of the Perl Monks concerning the following question:

With this simple program
print "foo "; sleep 10; print "bar ";
How do I make the 'foo' appear 10 seconds before the 'bar ' on the screen. At the moment it all appears when the program finishes. I have looked in the archives and found answers relating to CGI but I guess these are different circumstances.
Thanks for your help kind Monks.

Update on the command line it works in my editor it fails sorry folks!!!

Replies are listed 'Best First'.
Re: Flushing output to STDOUT
by EdwardG (Vicar) on May 25, 2004 at 08:32 UTC
    See the documentation for $| in perlvar