Just for grins, here's another way to do it:
#!/usr/bin/perl use strict; use warnings; my %charCount; my $corpus = join('', <DATA>); $corpus =~ tr/A-Z/a-z/d; # Map uppercase to lowercase $corpus =~ tr/a-z//cd; # Delete all but lowercase $charCount{$_}++ for split //, $corpus; for (sort keys %charCount) { print "$_ : $charCount{$_}\n"; } __DATA__ Now is the time for all good men to come to the aid of their party. The quick red fox jumped over the lazy brown dog. The warrior swings the +6 axe at the orcs standing in front of him.
...roboticus
In reply to Re: Hash to count characters
by roboticus
in thread Hash to count characters
by amittleider
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |