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