Beefy Boxes and Bandwidth Generously Provided by pair Networks DiBona
Welcome to the Monastery
 
PerlMonks  

Re: Re: Checking for array entry in another array

by 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.


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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://100025]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.