Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
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
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 exploiting the Monastery: (3)
As of 2020-12-04 04:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How often do you use taint mode?





    Results (58 votes). Check out past polls.

    Notices?