sub initThreads{ my @initThreads; for(my $i = 1;$i<=$num_of_threads;$i++){ push(@initThreads,$i); } return @initThreads; } # use the initThreads subroutine to create an array of threads. my @threads = initThreads();