in reply to How To Do This Better?
It works by finding a letter ("a-zA-Z"), lower-casing it, and increasing the count of that letter; and it does so for each letter that it finds.#!/usr/local/bin/perl -w use strict; my %count; s/([a-zA-Z])/{ $count{lc $1}++; $1 }/eg while <>; for my $letter (sort keys %count) { print $letter, "=", $count{$letter}, "\n"; }
|
|---|