Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery

Re: Find most frequently used word in text file.

by toolic (Bishop)
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

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (4)
As of 2016-10-22 18:10 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (297 votes). Check out past polls.