my $thr1 = threads->new(\&process3, 0,$endline, "c001n05"); my $thr2 = threads->new(\&process3, 0,$endline, "c001n06" ); ... $thr1->join(); $thr2->join(); ... #### my @thr; for (1..$numThreads) { push @thr, threads->new(\&process3, 0,$endline, sprintf "c001n%02d", 4 + $_); } $_->join () for @thr;