Okay, a couple of things:
1 - Do you expect your file to be one long line? If not, you need to "slurp" the file, rather than doing what you're doing now (reading only the first line). Try $big_string = do {local $/; <TEXTFILE>};.
2 - Your first substitution statement does not require the outside capturing parens. It's just noisy.
3 - I wouldn't sort the array before doing the frequency count, as it just takes time for little gain.
4 - Finally, in response to your last question as to how to actually do the count, I have a few suggestions. An idiom that is useful is, for each item to say $hash{$word}++. It creates an entry if the word has not been seen before, and increments it if has. Use a for loop or a map statement to construct the hash. In the end, use a sort with a routine which sorts by the entries in the hash and (optionally) afterwards ascii-betically by the actual words.
Hope that helped!
In reply to Re: tutelage needed
by jweed
in thread tutelage needed
by ctp
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |