my @threads = map { ## create the workers passing the log file handle and semaphore threads->create( \&worker, $log, \$logSem,$_*$N, $_*$N + $N -1); } 0 .. 5; ## 5 threads each processing 100 "files"