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


in reply to Frequency Analyzer

Your s/// for converting characters to lowercase is far too much work, and the use of $& is poisonous. I'd use the lc() function.

And you're using substr() where chop() would do, and probably where you could just use split().

while (<STDIN>) { $count{$_}++ for split //, lc; }
Is how I would optimize your input loop.

japhy -- Perl and Regex Hacker