deleting duplicates in array using references



i have a multidimensional array, but i want to delete duplicate
entries based on the first element of each 'row'.

my array is:

my @array = ( [UK9004411, A140, B, 0.040] , [UK0030239, H7140, H,
0.030] , [UK0030239, S1393, M1, 0.030] , [UK0012821, H4030, H,
0.010] , [UK0012821, H4060, H, 0.010] );

and I want to end up with
( [UK9004411, A140, B, 0.040] , [UK0030239, H7140, H, 0.030] ,
[UK0012821, H4030, H, 0.010] )

(no real preference in which row is dropped...just on a first come
first served basis.)

i.e. take out the duplicate codes based on the first element of each
row $array[$row] -> [0]

i looked into splice() function based on the index but not sure this
is the best way or the syntax for this?

splice (@array , $row, 1); ?

thanks.

.



Relevant Pages

  • Re: deleting duplicates in array using references
    ... entries based on the first element of each 'row'. ... $ perldoc -q duplicate ... How can I remove duplicate elements from a list or array? ...
    (comp.lang.perl.misc)
  • Re: Fastcode Sort benchmark design
    ... > - Completely random with many entries occurring multiple times ... Here you consider random data with many equal elements? ... Smaler than first element - position somewhere between first and last ...
    (borland.public.delphi.language.basm)
  • Re: Making a matrix non-singular
    ... I have two diagonal matrices, A and B with dimension N. ... Now I want to invert this matrix C. ... But because of the same value in the first element, ... I get around this by putting some random dummy value for the first entries of each of the four matrices in C. ...
    (sci.math)
  • Re: Multidimensional Array (I think)
    ... > _Is a multidimensional array the way to go? ... > _How do I read just the first element? ... To retrieve data -- ... 'iName is your index, ...
    (microsoft.public.scripting.vbscript)
  • Multidimensional Array (I think)
    ... I would like to create a multidimensional array and then use the value of each ... of the first element, then output to a text file the value of each of the two ... TIA, ... Bill Burke ...
    (microsoft.public.scripting.vbscript)