in reply to Re: Checking for array entry in another array
in thread Checking for array entry in another array
It won't work because map and grep both localise $_: inside the braces, $_ is aliased to each element of @sybfile in turn. But, grep also aliases $_ to each element of @ingfile, which hides the former $_.
In fact, you end up doing $_ =~ /$_/, which is pretty much always true. You have to save the map's $_ into some temporary variable:
print STDERR "DEBUG YYY\n" unless map { my $tmp = $_; grep /\Q$tmp\E/, @ingfile; } @sybfile;
HTH
--bwana147
|
|---|