$|++; for (1..10){ $pid[$_]=open($fh[$_],"-|"); next if $pid[$_]; print; exit(0); } foreach my $i (1..10){ my $fh=$fh[$i]; while(<$fh[$i]>){ print "'$_'"; } close $fh[$i]; } #### 'GLOB(0x2535298)''GLOB(0x25352e0)''GLOB(0x2535418)''GLOB(0x2541e38)''GLOB(0x2541ec8)''GLOB(0x25669d8)''GLOB(0x255ead8)''GLOB(0x2542420)''GLOB(0x25523a8)''GLOB(0x2542dc8)'