in reply to How To Do This Better?
s/([a-zA-Z])/{ $count{$1}++; $1 }/eg while <>; foreach (A .. Z) { $count{lc($_)} += $count{$_} || 0; } [download]