#!/usr/bin/perl open (AB, $ARGV[0]); while ($x = ) { print $x; $x =~ s/^\s*//g; $x =~ s/\s*$//g; $dictionary{$x} += 1; } close(AB); foreach $key (keys %dictionary) { print $key, " occurs ", $dictionary{$key}, "\n"; }