use strict ; use warnings ; use threads ; my @array = qw(a b c d e f g h); my @children; my @results; for (1..5) { for (1..2) { push @children, threads->create(\&sub_thread, @array) ; } ; while (@children) { my $child = shift(@children) ; push @results, $child->join() ; } ; } ; sub sub_thread { my (@temp) = (@_) ; my $tid = threads->tid() ; print "child $tid: @temp\n" ; sleep (2) ; return 'whatever' ; } ;