#!/usr/bin/perl
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #
# Given input text, produce an alpabetized list of the words, with each  word #
# preceded  the  count  of  the number of times it occurs.  The definition of #
# "word" may take a bit of work. At present, we only read from stdin; perhaps #
# we should also read from named files.                                       #
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #
while (<>) {
	split(/\_*[ \f\n\r\t;:,.()<>\[\]\/@`'"-]+\_*/);
	for (@_) {
		tr/A-Z/a-z/;	# Uncapitalize each word.
		$w{$_} ++		# Bump each word's counter.
			if ($_);	# Ignore null words.
	}
}
for $n (sort keys %w) {
	print "$w{$n}\t$n\n";
}
