in reply to Re: How To Do This Better?
in thread How To Do This Better?

That has the unfortunate consequence of modifying the original string. Easily worked around, but a limitation that ought to be pointed out. Besides that, it only counts the number of letters total, not the number of occurrences of each letter.

In the spirit of Not Working Very Hard, here's another option to do what you suggest:

$string = "abc1235ABC"; $number = ($string =~ tr[a-zA-Z][a-zA-Z]); print "I counted $number alphabetical characters.\n"; print "My string is still ->$string<-\n";
(can't believe I forgot about that one)