Skip to content

Instantly share code, notes, and snippets.

@redhotpenguin
Last active January 4, 2016 18:19
Show Gist options
  • Save redhotpenguin/8659953 to your computer and use it in GitHub Desktop.
Save redhotpenguin/8659953 to your computer and use it in GitHub Desktop.
my $paragraph = <>;
my @words = split(/\s+/, $para);
my %counts;
foreach my $word (@words) {
$counts{length($word)}++;
}
foreach my $count (keys %counts) {
my $num = $counts{$count};
print "$num words with $count letters\n";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment