Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: How do you place words from a sentence into an array?

by TedPride (Priest)
on Oct 26, 2004 at 21:10 UTC ( #402801=note: print w/replies, xml ) Need Help??


in reply to How do you place words from a sentence into an array?

The following tracks word frequency:
use strict; use warnings; my %hash; while (<DATA>) { chomp; $hash{$_}++ for (split); } print "ALPHABETIC\n"; print "$_ $hash{$_}\n" for (sort keys %hash); print "\nBY NUMBER\n"; print "$_ $hash{$_}\n" for (sort {$hash{$b} <=> $hash{$a} || $a cmp $b} keys %hash); __DATA__ three blind mice three blind mice see how they run

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (3)
As of 2022-05-28 19:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (101 votes). Check out past polls.

    Notices?