Not sure it is really better but you could use a hash where you add the "value" of each letter (the letter is the key and your assigned number is the value for that key). You initialize you hash with all those numbers. Then you add a counter next to the value, to keep track of occurrences. Thus, at any given point your hash entry for letter P would be 234, 689 (P has value 234 and was found 689 times). When you're done combing your string you can collect all the data you need from the hash. Uses some more memory but makes browsing your string easier (I understand you may not be interested in all letters so feel free to extract only what you care for).
This seems more Perl-style: use some more resources to make your life easier... not sure it's always a good approach but hey, this is Perl :)
Hope this helps!