in reply to Remove Duplicates from an Array of Arrays

Consider mapping?
my %seen_values; for my $aref (@array_of_arrayrefs) { $aref = [ map { $seen_values{$_}++ ? () : $_ } @$aref ]; }
For every arrayref in the list, transform the arrayref's array as follows: if the value has been seen before, ignore it. Otherwise, include it. Either way, make sure you note that you've seen it.

NOTE! This removes any value that's seen more than once. I think, though, that you want to remove entire pairs that are seen more than once. Your use of arrows makes it seem like you care about pairs. After all, it's like =>, used in marking hash pairs. So, if you indeed meant duplicated arrayrefs, not duplicated deep values...
my %seen_values; my @new_AofA = map { $seen_values{$_->[0]}{$_->[1]}++ ? () : $_ } @Aof +A;
It's the same thing, but we're using a two-level hash. After all, it's a lot like what you were thinking, isn't it?

If this isn't clear, I can elaborate on how it works. I know using $_ makes some people glaze over...
rjbs

Replies are listed 'Best First'.
Re^2: Remove Duplicates from an Array of Arrays
by Roy Johnson (Monsignor) on Jul 14, 2004 at 16:43 UTC
    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.
      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
      Given the data, using old-style multidimensional hashing would work also:
      my @new_AofA = grep { !$seen{$_->[0],$_->[1]}++ } @AofA;