open(A, "a.txt"); my @a = ; my %dic; foreach (@a) { chomp($_); $dic{lc $_}++; } foreach (sort keys %dic) { print $_."/t".$dic{$_}."/n"; }