What do you mean by "select such PID"?
Are you asking about a good algorithm to do load scheduling? Or do you want to know how to pass information from your master process to child process XX?
Personally, I would look into queues, and invert the problem. Have the master post jobs into the queue and the workers take jobs from that queue. That way ou don't have idle workers.
Such a setup can range from directories into which jobs are placed and moved via rename by the clients to various Queues. Depending on your needs about the queues (persistence, deliver at most once, deliver at least once), you could use Forks::Queue or Thread::Queue or Queue::DBI or IPC::DirQueue, or ZMQ or MQSeries::Queue.