Skip to content

Instantly share code, notes, and snippets.

@Ming-Tang
Last active September 24, 2015 13:27
Show Gist options
  • Save Ming-Tang/755154 to your computer and use it in GitHub Desktop.
Save Ming-Tang/755154 to your computer and use it in GitHub Desktop.
Simplest word count implementation
#!/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