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

$counts{$_}++ for @test;
or (for us antediluvian 5.004 types)
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...

@redundant = grep {++$counts{$_} > 1} @test;
Oops!
@redundant = grep {++$counts{$_}==2} @test;
and a pox on foolish monks who post without full testing...



If God had meant us to fly, he would *never* have give us the railroads.
    --Michael Flanders