use Proc::Queue size => 2, qw(system_back); for (1..$total_number_of_runs) { system_back "shell_script < $input_file" } # and wait for all your children to finish 1 while wait != -1;