in reply to Get Vowels from sentence
If what you want is to end up with a histogram-like structure, stuff the found vowels into a hash. You may try something like this:
my $phrase = 'There once was a doggy in the window. I went into the st +ore and inquired about the price, the doggy was too nice to ever thin +k twice, so now I have a doggy to care for.'; my %vowels; while ($phrase =~ /([aeiou])/gi) { $vowels{lc $1}++; } use YAML; print Dump \%vowels; __END__ the output would look like --- a: 8 e: 17 i: 11 o: 15 u: 2
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Get Vowels from sentence
by Anonymous Monk on Nov 02, 2017 at 09:29 UTC | |
by Corion (Patriarch) on Nov 02, 2017 at 10:02 UTC |