my %set1 = map { $_ => 1 } @array1;
my %set2 = map { $_ => 1 } @array2;
my %intersection = map { $_ => 1 } grep $set1{$_}, keys %set2;
and you missed so many points from my post that I assume that you only read the headings..
Are you trying to imply that I should have told you you need to use a hash to get the original from the stringification even you already know that?
Or are you referring to request to avoid loops? Yeah, I missed that bit of nonsense. It's impossible to find the intersection of two sets without looping over the two sets.
|