>I needed to find all the duplicate values in an array and their count of >occurences. Any help would be appreciated .
You could use a hash: use strict; use warnings; my @animals = ("cat","dog","wombat","cat","monkey","cat","monkey"); my %howmany; foreach my $critter (@animals) { $howmany{$critter}++; } foreach my $key (keys %howmany) { print "$key $howmany{$key}\n"; } If you only want cases with count > 1 then put an if around the print. Capgemini is a trading name used by the Capgemini Group of companies which includes Capgemini UK plc, a company registered in England and Wales (number 943935) whose registered office is at No. 1 Forge End, Woking, Surrey, GU21 6DB. This message contains information that may be privileged or confidential and is the property of the Capgemini Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorized to read, print, retain, copy, disseminate, distribute, or use this message or any part thereof. If you receive this message in error, please notify the sender immediately and delete all copies of this message. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/