#!/usr/bin/perl -w while (<>) { $COUNT{$_}++ for map lc, split /\W+/; } print "$_: $COUNT{$_}\n" for sort keys %COUNT;