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