#!/usr/bin/perl -w use strict; my @array=qw(John Sue Larry Mary John Mary Larry John Joe Lisa John Mary); my %hash; foreach (@array) { $hash{$_}++; } foreach (keys %hash) { print"Key is : [$_]\n"; } foreach (values %hash) { print "Value is : [$_]\n"; }