Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Find most frequently used word in text file.

by toolic (Chancellor)
on Dec 19, 2013 at 19:51 UTC ( #1067877=note: print w/ replies, xml ) Need Help??


in reply to Find most frequently used word in text file.

I think there is a bug. You sort lexically, not numerically. Try this instead:

@values = sort { $a <=> $b } @values;

Tip #1 from the Basic debugging checklist: use strict and warnings. strict generates a compile error, and warnings generates these (and more):

Scalar value @values[-1] better written as $values[-1] Name "main::file" used only once: possible typo


Comment on Re: Find most frequently used word in text file.
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (6)
As of 2014-09-19 22:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (149 votes), past polls