$pool = Pool::Of::Threads->new(how_many_threads => 5); for (1 .. 1000) { $pool->job({sleep 5; print ($_: I'm in the thread}); }