use threads; my @kiddies; foreach(1..10) { print "$$ starting loop $_"; push @kiddies, threads->new(\&thisWasAnElse); print "$$ exiting loop $_"; } sub thisWasAnElse { print "\tchild ", threads->tid() " created ok"; sleep(int(rand(10))); print "\tchild", threads->tid() , " done, outta here"; } foreach @kiddies { $_->join(); }