@names=qw/tom tom tom green/; my%h;%_=map{$h{$_}++}@names;map{print"$_=",$h{$_},"\n"}keys%h;