Thanks Andrea & Rex. I think I understand the commify issue but need to work on understanding the syntax. Will come back to the list if I can't hack it. Regards Clinton ----- Original Message ----- From: "Rex Arul" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]>; "Andrea Holstein" <[EMAIL PROTECTED]> Sent: Friday, November 09, 2001 11:03 PM Subject: Re: Duplicates in 2D Array
> Andrea, > > Even if you do have commified strings, it should still work. Right? > > ################################### > use strict; > my(@array, @unique, %seen); > $array[0] = ["apples","oranges","plums", "Arul, Rex", "Holstein, Andrea", > "Clinton,Bill"]; > $array[1] = ["asparagus", "corn","peas"]; > $array[2] = ["ham","chicken","lamb"]; > $array[3] = ["apples","oranges","plums", "Arul, Rex", "Holstein, Andrea", > "Clinton,Bill"]; > my @unique = grep {!$seen{join (", ", @$_)}++} @array; > map { print "@$_ \n" } @unique; > ################################## > > Here is the output: > > C:\Perl\Rex>perl testunique.pl > apples oranges plums Arul, Rex Holstein, Andrea Clinton,Bill > asparagus corn peas > ham chicken lamb > > > > > > > > > Why dirty? > > I simply join all entries in every array with a ", ". > > It's not general that in strings aren't commata :-) > > > > Best Wishes, > > Andrea > > > > > > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]