<[EMAIL PROTECTED]> asked: > I need to test if an array holds duplicates, and if so do something.
Try
use strict;
use warnings;
my @array = qw(foo baz bar foo);
my %have;
foreach my $item (@array){
warn "duplicate item $item" if exists $have{$item};
$have{$item}++;
}
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>
