in reply to Re: Reporting entries in a file
in thread Reporting entries in a file
#!/usr/bin/perl while (<>) { @words = split(/\n+/); foreach $word (@words) { $count{$word}++; } } foreach $word (sort by_count keys %count) { print "$word \: $count{$word}\n"; } sub by_count { $count{$b} <=> $count{$a}; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Reporting entries in a file
by alexm (Chaplain) on May 30, 2008 at 22:26 UTC | |
|
Re^3: Reporting entries in a file
by SkullOne (Acolyte) on May 30, 2008 at 22:13 UTC |