http://qs321.pair.com?node_id=64863


in reply to Frequency Analyzer

Interesting that you should bring this up. In my "AP Computer Science" class (unfortunatly taught in C), the teacher promised that one of the harder projects later in the year would be to do this exact problem. Within 2 minutes I turned in the following code:

perl -ne 'chomp;$c{$_}++ for split//;}print map {"$_:$c{$_}\n"} sort keys %c;{'

..which is a cruder version of what you have above. Whenever I can, I enjoy putting pained looks on the other student's faces as I hand-write in pencil my code, whilst they print out reams of paper.. :)

 
perl -e 'print "I love $^X$\"$]!$/"#$&V"+@( NO CARRIER'