in reply to split sleep question

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

Replies are listed 'Best First'.
Re^2: split sleep question
by learn_perl_se (Initiate) on May 01, 2009 at 16:19 UTC
    Thank You very much for Your fast replies! Both examples worked like a charm!