in reply to
Deleting elements of one list using another
Untested and unnecessary verbose, but I think you'll get the idea:
use strict;
use warnings;
my @arr1 = ("John, ABC, 42","Jane, XYZ, 34","Jessica, GHI, 21");
my @arr2 = ("ABC", "XYZ");
my @arr3;
my %seen;
foreach my $arr1(@arr1) {
my @splitted = split (/,/, $arr1);
foreach my $arr2(@arr2) {
if (grep(/$arr2/, @splitted)) {
unless ($seen{$arr1} ){
push (@arr3, $arr1);
}
}
}
}
for (@arr3) {print "$_\n";}
I'm too lazy to be proud of being impatient.