|
|
|
Clear questions and runnable code get the best and fastest answer |
|
| PerlMonks |
Re: A another tr/// statement question..by bwana147 (Pilgrim) |
| on Jul 19, 2001 at 12:55 UTC ( [id://98055]=note: print w/replies, xml ) | Need Help?? |
This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.
I'd rather not open and close the file more than once: disk accesses take time (there's the cache, you didn't mention your file's size). Instead, I would first generate subs that count a given character and store them in a hash, referenced by that character. Then, for each line in the file, loop over the letters and call the sub from the hash. Increment a counter which is itself stored in a hash.
--bwana147
In Section
Seekers of Perl Wisdom
|
|
||||||||||||||||||||||||