Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: Frequency Analyzer

by japhy (Canon)
on Mar 16, 2001 at 20:38 UTC ( #64948=note: print w/replies, xml ) Need Help??


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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://64948]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (4)
As of 2021-11-29 23:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?