in reply to Re: Finding Redundant values in arrays
in thread Finding Redundant values in arrays
or, for slightly better performance (IIRC), ditch map in void context, and use
or (for us antediluvian 5.004 types)$counts{$_}++ for @test;
for (@test) {$counts{$_}++}
I was hoping there was a Schwartzian Transform analog for this, just for the fun of running the whole thing into one line, but I can't come up with one.
Update: No sooner posted than obsolete...
Oops!@redundant = grep {++$counts{$_} > 1} @test;
and a pox on foolish monks who post without full testing...@redundant = grep {++$counts{$_}==2} @test;
|
|---|