in reply to Fast Way to Return Unique Array of Array
Slightly modify the original uniq(), it works:
use Data::Dumper; my @AoA = (['a','b','c'], ['a','b','c'], ['a','b','d'], ['a','b','d']); my @uAoA = uniq(@AoA); print Dumper \@uAoA; sub uniq () { my %h; map { $h{join($;, @$_)}++ == 0 ? $_ : () } @_; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Fast Way to Return Unique Array of Array
by calin (Deacon) on Sep 05, 2005 at 10:17 UTC | |
by pseudomonas (Monk) on Sep 05, 2005 at 12:19 UTC |