Unique Array of Arrays

This is a discussion on "Unique Array of Arrays" within the Other Programming Languages section. This forum, and the thread "Unique Array of Arrays are both part of the Program Your Website category.



Go Back   Webforumz.com > Main Forums > Program Your Website > Other Programming Languages

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Jan 27th, 2006, 09:14
Up'n'Coming Member
Join Date: Sep 2005
Location: athens
Age: 25
Posts: 60
Thanks: 0
Thanked 0 Times in 0 Posts
Unique Array of Arrays

Hi all!
I have an array of arrays that i want to make unique. That is, I have:
@AoA=(["1","15"], ["2","5"], ["3","4"], ["3","5"], ["3","8"], ["3","5"], ["4","6"], ["4","5"])
and I want to remove array element ["3","5"] which is seen twice if you notice.
Is that possible? I am confused with this!
Reply With Quote

  #2 (permalink)  
Old Jan 27th, 2006, 16:30
Reputable Member
Join Date: Jul 2005
Location: Melksham, Wilts, UK
Posts: 293
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Unique Array of Arrays

Is this Perl? If so, use splice:

Code: Select all
@AoA=(["1","15"], ["2","5"], ["3","4"], ["3","5"], ["3","8"], ["3","5"], ["4","6"], ["4","5"]);

foreach $part(@AoA) {
        print ("@{$part} ..."); }
print "\n";

splice(@AoA,5,1);

foreach $part(@AoA) {
        print ("@{$part} ..."); }
print "\n";
Results:

Code: Select all
earth-wind-and-fire:~/jan06 grahamellis$ perl ppd
1 15 ...2 5 ...3 4 ...3 5 ...3 8 ...3 5 ...4 6 ...4 5 ...
1 15 ...2 5 ...3 4 ...3 5 ...3 8 ...4 6 ...4 5 ...
earth-wind-and-fire:~/jan06 grahamellis$
Reply With Quote
Reply

Tags
unique, array, arrays

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
arrays images and backgroundImage gleb JavaScript Forum 0 Sep 9th, 2007 20:39
Looping through arrays assgar Starting Out 1 Apr 22nd, 2007 18:43
Sorting a new array from an existing array Ozeona Flash & Multimedia Forum 2 Sep 20th, 2005 08:43
array unable to check another array so as to be displayed Ozeona Flash & Multimedia Forum 1 Aug 5th, 2005 10:26
arrays? macupryk ASP.NET Forum 1 Sep 30th, 2003 12:44


All times are GMT. The time now is 22:27.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43