Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

RE: RE: Word Counter

by chromatic (Archbishop)
on May 09, 2000 at 20:18 UTC ( [id://10772]=note: print w/replies, xml ) Need Help??


in reply to RE: Word Counter
in thread Word Counter

How about a round of golf, merlyn? perl -ne '$a{$_}++ for split; END { print join "\n", (sort { $a{$b} <=> $a{$a} } keys %a)[0 .. 9]; } <filename>

Replies are listed 'Best First'.
RE: RE: RE: Word Counter
by takshaka (Friar) on May 09, 2000 at 22:16 UTC
    perl -lne '$a{$_}++ for split } print for (sort { $a{$b} <=> $a{$a} } keys %a)[0..9]; {' <filename> or even better: perl -lpe '$a{$_}++ for split } for ((sort { $a{$b} <=> $a{$a} } keys %a)[0..9]) {' <filename>

Log In?
Username:
Password:

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

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

    No recent polls found