I have a file with lines like so but the number of them is in the
thousands instead of seven lines:

blue
red
red
red
orange
orange
green

I want it to count the occurances of each word it finds in the file.
So output on this small file would be:

blue (1)
red (3)
orange (2)
green (1)

The contents of the file are sorted already.  Any ideas how to do this?  Thanks.

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to