in reply to Re^6: Is there better way to delete dups in an AoH?
in thread Is there better way to delete dups in an AoH?
The principle is the same as before: make a hash entry for each item, then find all the unique keys and rebuild the original AoH from that. The only difference is that we're going two levels deep.my %uniq; for (@$AoH) { $uniq{$_->{page}}{$_->{chap}} = 1; } @$AoH = map { my $k = $_; map { {page => $k , chap=>$_} } keys %{$uniq{$k}}; } keys %uniq;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^8: Is there better way to delete dups in an AoH?
by bradcathey (Prior) on Jun 08, 2004 at 11:03 UTC |