use warnings; use strict; my @cmd = 1 .. 200; my $i = 0; for (@cmd) { print "$_\n"; $i++; sleep 2 if $i % 20 == 0; }