my $found = 0; for (qx){ next unless /myhost/; found = 1; last; }