The above works, but you are Suffering from Buffering.
Set autoflush if you want output to STDOUT to appear unbuffered:
$| = 1;
Alternatively, print newlines:
foreach (1..20) { print "a\n"; sleep (1);#between each element of the array there should be 1 sec +ond interval }
In reply to Re: Foreach time delay
by Corion
in thread Foreach time delay
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |