monkfan has asked for the wisdom of the Perl Monks concerning the following question: ⭐ (arrays)
Given this:
I wish to return simply this:my @AoA = ( ['a','b','c'], ['a','b','c'], ['a','b','d'], ['a','b','d'], );
From the original posting in SoPW, one can find many answers. One of them is (by TedPride), seems to me to be the most compact of them all:my @uAoA = ( ['a','b','c'], ['a','b','d'], );
use strict; use warnings; use Data::Dumper; my @AoA = ( ['a','b','c'], ['a','b','c'], ['a','b','d'], ['a','b','d'], ); my (%h, @uAoA); for (@AoA) { push @uAoA, $_ if !$h{join $;, @$_}++; } print Dumper \@uAoA;
Originally posted as a Categorized Question.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: How do I find unique Array in Array of Arrays?⭐
by bart (Canon) on Dec 18, 2007 at 13:23 UTC | |
Re: How do I find unique Array in Array of Array?⭐
by jdporter (Paladin) on May 11, 2006 at 16:34 UTC | |
by TedPride (Priest) on May 12, 2006 at 06:33 UTC | |
by jdporter (Paladin) on May 12, 2006 at 19:32 UTC | |
Re: How do I find unique Array in Array of Array?⭐
by mohan123 (Novice) on Jun 13, 2006 at 13:32 UTC | |
Re: How do I find unique Array in Array of Arrays?
by rajesh.bodagala (Initiate) on Dec 18, 2007 at 12:22 UTC | |
by moritz (Cardinal) on Dec 18, 2007 at 12:37 UTC | |
Re: How do I find unique Array in Array of Array?
by perladdict (Chaplain) on May 11, 2006 at 06:42 UTC |
Back to
Seekers of Perl Wisdom