Jump to content

Perl Vowel-Word Counter


G+_Darryl Medley
 Share

Recommended Posts

Perl Vowel-Word Counter.

https://github.com/Darryl-Medley/Coding-101/blob/master/VowelWordCounter.pl

This is a little regex demo that counts the number of words containing each vowel (# of words with "a", # of words with "e", etc.) in a user-entered sentence. It shows two valuable regex techniques: 1. using a regex with "while" to count things, and, 2. Programatically building a regex in a string variable at run time and using it. The program shows two methods to do the count. The first is easy to understand straight-line code with a regex for each vowel and the second is a trickier but shorter routine that loops for each vowel.

https://github.com/Darryl-Medley/Coding-101/blob/master/VowelWordCounter.pl

Link to comment
Share on other sites

  • 2 weeks later...
 Share

×
×
  • Create New...