my $tcount = count of tests that are running. while (1) { if ( $Q->pending ) { $_ = $Q->dequeue; chomp; if (/ENDEND$/) { $done++; print "\t-->got $done/$t_count $_\n"; } last if ( $done == $t_count ); next if (/ENDEND$/); } }