in reply to problem with delay(my little code)

Hi there, the answer to your question is the buffering issue but here are a coulpe more points that may be of interest.

#!/usr/bin/perl -w # -w is the old way to do use warnings, you can drop it # as you use warnings anyway use strict; use warnings; my $text="this is a sample"; # no need to make the following intermediate array # no need to use the brackets for split unless to disambiguate # no need to "quote" $text my @word=split(//, "$text"); # if we loose @word we can just loop directly on the split for (0 .. $#word){ # no need to quote $word[$_] here either print "$word[$_]"; sleep 2; } print "\n"; ###################### # new shorter code.. # ###################### #!/usr/bin/perl use strict; use warnings; $|++; my $text="this is a sample"; for (split //, $text) { print; # defaults to print $_, some don't like this style sleep 2; } print "\n";

Cheers,
R.

Pereant, qui ante nos nostra dixerunt!