Question

#!perl6
use v6;

my $message = "\nHello!\n\nSleep\nTest\n\n";

my @a = $message.split( '' );

for @a {
    sleep 0.3; 
    .print;
}

Does perl6 enable "autoflush" by default. With perl5 without enabling "outflush" I don't get this behavior.

Was it helpful?

Solution

Rakudo enables autoflush by default; the specification is silent about the default.

OTHER TIPS

Quoting from the docs regarding auto flush:

‘No global alternative available. TTY handles are unbuffered by default, for others, set out-buffer to zero or use :!out-buffer with open on a specific IO::Handle.’

So any printing to stdout is unbuffered and I guess would behave similar to auto flushed stdout of perl5.

Other handles depend on the out-buffer size set.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top