Come for the quick hacks, stay for the epiphanies. | |
PerlMonks |
Re: Re: Word Countingby samurai (Monk) |
on Apr 24, 2003 at 21:02 UTC ( [id://253004]=note: print w/replies, xml ) | Need Help?? |
I would reccomend
$wordhash{lc $word}++;
as opposed to
$wordhash{$word}++;
if you're not worried about case-sensitivity, so you don't end up with:
To: 50 Also, if you're going to split on \s+ as everyone seems to be suggesting, don't forget you're going to have to $word =~ s/\W//g to get rid of those unsightly punctuation marks.
--
In Section
Seekers of Perl Wisdom
|
|