Last active
September 24, 2015 13:27
-
-
Save Ming-Tang/755154 to your computer and use it in GitHub Desktop.
Simplest word count implementation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
while (<>) { $hash{$_} ++ foreach split /\s+/, $_; } | |
print "$_: $hash{$_}\n" foreach sort { $hash{$a} <=> $hash{$b} } keys %hash; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment