for ($i=0; $i<`#of children to do`; $i++;) { $pid[$i]= open($created_file_handle, "$custom_call_statement -|"); if ($pid[$i]) { waitpid($pid[$i], 0); } # parent waits for child to finish } else { while (<$created_file_handle>) { $out[$i] .= $_; } # add output to the array exit; } }