* "Desai, Sheetal A" <[EMAIL PROTECTED]> [2004:02:18:09:03:12-0500] scribed:
> OK I have two arrays and I was wondering what would be the best way to get a
> third arrays that contains distinct values from both these arrays. There are
> pretty big arrays and thus converting each value into a hash key might take
> forever. 

Are you looking for symmetric difference?

   my %count;
   my @diff;
   my $e;
   
   for $e (@a, @b) { $count{$e}++ }
   
   for $e (keys %count) {
      push @diff, $e
         if $count{$e} == 1;
   }

hth

-- 
Best Regards,

mds
mds resource
877.596.8237
-
Dare to fix things before they break . . .
-
Our capacity for understanding is inversely proportional to how much
we think we know.  The more I know, the more I know I don't know . . .
--

Attachment: signature.asc
Description: Digital signature

Reply via email to