Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Frequency Analyzer

by japhy (Canon)
on Mar 16, 2001 at 20:38 UTC ( [id://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?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (None)
    As of 2024-04-25 04:25 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      No recent polls found