This is very easy in Perl, as the transliteration operator returns the number of matches:
sub vowel_count2{shift=~tr/aeiouAEIOU//}
One can also use the Saturn (or Goatse) "secret" operator with a regex match:
sub vowel_count{my$count=()=shift=~/[aeiou]/gi}
The global match returns all the matches in list context, the assignment to () enforces list context, and enforcing scalar context on it by a scalar assignment returns the number of elements.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
This is very easy in Perl, as the transliteration operator returns the number of matches:
One can also use the Saturn (or Goatse) "secret" operator with a regex match:
The global match returns all the matches in list context, the assignment to () enforces list context, and enforcing scalar context on it by a scalar assignment returns the number of elements.