Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Get Vowels from sentence

by ferreira (Chaplain)
on Jan 04, 2007 at 10:04 UTC ( [id://592919]=note: print w/replies, xml ) Need Help??


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
    use YAML means can u explain

      See use and YAML.

      The use statement loads the module YAML.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://592919]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (8)
As of 2024-04-23 08:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found