page=>'fall', chap=>'fall'BUT, what if they are different:
Which prints:my $AoH = [ { page => 'main', chap => 'About'}, { page => 'main', chap => 'Contact'}, { page => 'main', chap => 'About'}, { page => 'sub', chap => 'About'}, { page => 'sub', chap => 'Contact'} ]; my %uniq = map { ($_->{page} => 1, $_->{chap} => 1) } @$AoH; @$AoH = map { { page => $_ , chap=>$_ } } keys %uniq; print Dumper ($AoH);
I want to end up with:$VAR1 = [ { 'chap' => 'Contact', 'page' => 'Contact' }, { 'chap' => 'About', 'page' => 'About' }, { 'chap' => 'sub', 'page' => 'sub' }, { 'chap' => 'main', 'page' => 'main' } ];
eliminating that dupe element of:$VAR1 = [ { 'page' => 'main', 'chap' => 'About' }, { 'page' => 'main', 'chap' => 'Contact' }, { 'page' => 'sub', 'chap' => 'About' }, { 'page' => 'sub', 'chap' => 'Contact' } ];
I've stared at it for an hour and am bewildered. Ideas? Thanks.'page' => 'main', 'chap' => 'About'
In reply to Re^6: Is there better way to delete dups in an AoH?
by bradcathey
in thread Is there better way to delete dups in an AoH?
by bradcathey
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |