in reply to Re: Remove Duplicates from an Array of Arrays
in thread Remove Duplicates from an Array of Arrays

Doesn't it seem like grep is a more natural choice?
my %seen_values; my @new_AofA = grep { !($seen_values{$_->[0]}{$_->[1]}++) } @AofA;

We're not really tightening our belts, it just feels that way because we're getting fatter.

Replies are listed 'Best First'.
Re^3: Remove Duplicates from an Array of Arrays
by rjbs (Pilgrim) on Jul 14, 2004 at 17:01 UTC
    Yes, you're quite right. I think I got map in my head for some reason and ran with it! Anyway, fortunately both will work, and the use of %seen is the thing Dru probably needs. Roy's grep example helps make that clearer.
    rjbs
Re^3: Remove Duplicates from an Array of Arrays
by ysth (Canon) on Jul 14, 2004 at 17:33 UTC
    Given the data, using old-style multidimensional hashing would work also:
    my @new_AofA = grep { !$seen{$_->[0],$_->[1]}++ } @AofA;