Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: How do I find unique Array in Array of Array?

by perladdict (Chaplain)
on May 11, 2006 at 06:42 UTC ( [id://548616]=note: print w/replies, xml ) Need Help??


in reply to How do I find unique Array in Array of Arrays?

hi ,monk

Try the following code. I can't claim any credit for this.

#!/usr/bin/perl -w @AoA=(["1","15"], ["2","5"], ["3","4"], ["3","5"], ["3","8"], ["3","5" +], ["4","6"], ["4","5"]) ; # print out original array foreach $a (@AoA) { print "["; foreach $v (@{$a}) { print $v,","; } print "],"; } print "\n"; # now remove duplicates - see web page for explanation %temp = (); @list = grep ++$temp{join(",",@{$_})} < 2, @AoA; # now print again to see amended list foreach $a (@list) { print "["; foreach $v (@{$a}) { print $v,","; } print "],";

Originally posted as a Categorized Answer.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://548616]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (5)
As of 2025-06-13 16:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.