in reply to Re: Eliminate Array of array duplication
in thread Eliminate Array of array duplication
His bad formatting mislead you. He wants to turn
@AoD = ([11,12,22], [11,12,22], [13,15,18]);
into
@AoD = ([11,12,22], [13,15,18]);
Ignoring that, the advantage of previously mentioned
my %seen @AoD = grep !$seen{$_}++, @AoD;
over your solution
my %seen = map { $_ => 1 } @AoD; @AoD = keys(%seen);
is that the former maintains the order of the elements it keeps.
|
|---|