#! perl -slw use strict; my @array = ('bent', 'svend', 'gert','pete','svend','pete'); my ($temp, $count) = ("@array", 0); ($count = $temp =~ s/($_)//g) and printf "%2d:%s\n", $count, $_ for @array; __END__ c:\test>213719 1:bent 2:svend 1:gert 2:pete c:\test>