Adding $| = 1; (see Suffering from buffering) and replacing your \n with a space:
#!/usr/bin/perl use strict; use warnings; $| = 1; my $str = "Hello!"; foreach ( split // , $str ){ print "$_ "; #note the space sleep 1; } print "\n";
Will do what I think you want.
Martin
In reply to Re: split sleep question
by marto
in thread split sleep question
by learn_perl_se
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |