From: [EMAIL PROTECTED]
> I would expect the following script:
> 
>      use strict;
>      use warnings;
>      print 8*8;
>      sleep 3;
>      print 7*7;
> 
> To behave as follows.
> 
>      1. print 64.
>      2. pause 3 seconds.
>      3. print 49.
> 
> Instead the behavior is:
> 
>      1. pause 3 seconds.
>      2. print 64.
>      3. print 49.
> 
> Why is that, and how do I insert a pause in between these two print
> commands (as an example)?

Standard output is line-buffered by default. Try:

use strict;
use warnings;
use FileHandle;
STDOUT->autoflush();

print 8*8;
sleep 3;
print 7*7;


HTH, Jenda
===== [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =====
When it comes to wine, women and song, wizards are allowed 
to get drunk and croon as much as they like.
        -- Terry Pratchett in Sourcery


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to