foreach $item (@yourList) { $newHash{$item}++; } print "\n"; foreach $item (keys %newHash) { print "\n"; } print "
$item$newHash{$item}
\n";