my $found; ($found) = grep ...; if (defined $found) { return $found + 1; } else { return 0; }