It's easy, you should turn on autoflush on STDOUT
use strict; use warnings; use IO::Handle; autoflush STDOUT 1; my $str = "Hello!"; chomp($str); foreach ( split //, $str ) { print $_, " "; sleep 1; } print "\n";
Update: or use $|=1 as proposed by gwadej, in case of SDTOUT that perhaps better solution.
In reply to Re: split sleep question
by zwon
in thread split sleep question
by learn_perl_se
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |