in reply to Re: What is the best way to get just the duplicates from an array?
in thread What is the best way to get just the duplicates from an array?
Thanks! The perlfaq4 example (with the ! for unique removed) is the one that I'll use from now on.
my %seen = (); my @duplicates = grep { $seen{ $_ }++ } @array;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: What is the best way to get just the duplicates from an array?
by ikegami (Patriarch) on Jul 27, 2007 at 16:09 UTC |