in reply to wait before forking more

I am curious and want to know if there is a way in perl to wait for a number of processes to finish inside the for loop before forking more

That is exactly what Parallel::ForkManager does! When the forking limit is reached it waits for some child to exit before forking a new one again.

Replies are listed 'Best First'.
Re^2: wait before forking more
by Otogi (Beadle) on Feb 17, 2006 at 17:41 UTC
    Parallel:ForkManager does not seem to do this or I am using it incorrectly, this is essentially the structure I am using.
    foreach $device (keys %devices) { $pm->start and next; ..... $pm->finish; }
    I dont use $pm-<wait_all_children since i want it to continuously get input while children are processing.