Clinton wrote:
> 
> How would I eliminate the duplicate in this 2D array?
> my @array;
> $array[0] = ["apples","oranges","plums"];
> $array[1] = ["asparagus", "corn","peas"];
> $array[2] = ["ham","chicken","lamb"];
> $array[3] = ["apples","oranges","plums"];
> 

A quick and dirty solution is:
my %seen;
my @uniq_array = grep {!$seen{join (", ", @$_)}++} @array;

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]

Reply via email to