#! /usr/bin/perl my (@words , %count , $words); chomp(@words = ); foreach $words (@words){ $count{$words} += 1; } foreach $word (sort keys %count){ print "$word has appeared $count{$word} times\n"; }