in reply to Comparing two arrays (was: any smart ideas??:)

This can be found in the node mentioned above, the Perl Cookbook and a few other places.

@array1 = (1,2,3,4,5); @array2 = (2,4,6,8,10); %map2 = map {$_ => 1} @array2; @intersection = grep ($map2{$_}, @array1); print "@intersection\n";

--
Steve Marvell