#!/usr/bin/perl -w use strict; my @array=qw(John Sue Larry Mary John Mary Larry John Joe Lisa John Mary); my $i; my $lastindex=$#array; my $count=0; foreach (@array) { for($i=0;$i<=$lastindex;$i++) { if($_ eq $array[$i]) { $count++; } } print"$_ is repeated for $count times \n"; $count=0; }