in reply to Finding Redundant values in arrays
@test = ("camel","alpaca","penguin","alpaca","monkey","camel","camel") +; my %counts; $counts{$_}++ foreach @test; @redundant = grep { $counts{$_}>1 } keys(%counts);
And please note that camels are never redundant <g>.
update: changed map to foreach so as to avoid the dreaded map in void context
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Finding Redundant values in arrays
by ChemBoy (Priest) on Jun 08, 2001 at 01:11 UTC |