#save a reference to a single array containing the lines from both sub-processes: $results[$j][$z] = [ @result_1, @result_2 ]; print $results[$j][$z][0]; # print the first line of the total output # # or # # save a reference to an array containing references to two arrays each containing the output of one sub-process: $results[$j][$z] = [ \@result_1, \@result_2 ]; print $results[$j][$z][0][0]; #print the first line from test1.ksh print $results[$j][$z][1][0]; #print the first line from test2.ksh