in reply to Re: Deleting elements of one list using another
in thread Deleting elements of one list using another
Right idea but you aren't using anything to anchor the pattern, so you would also match 'JohnABC, CDE, 14'
@arr1 = ("0000007 | John | ABC.txt | 42","0000014 | Jane | XYZ.txt | 3 +4","0000017 | Jessica | GHI.txt | 21", etc); @arr2 = ('0000007', '0000014'); my $re = join('|',@arr2); my @arr3 = grep /^(?:$re)\s/, @arr1; print join("\n",@arr3),"\n";
In Section
Seekers of Perl Wisdom