|
|
| Welcome to the Monastery | |
| PerlMonks |
Re: Re: Checking for array entry in another arrayby bwana147 (Pilgrim) |
| on Jul 26, 2001 at 15:50 UTC ( [id://100025]=note: print w/replies, xml ) | Need Help?? |
This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.
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:
HTH --bwana147
In Section
Seekers of Perl Wisdom
|
|
||||||||||||||||||||||||