Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: Checking for array entry in another array

by PrakashK (Pilgrim)
on Jul 26, 2001 at 20:13 UTC ( #100033=note: print w/replies, xml ) Need Help??


in reply to Checking for array entry in another array

Hash slices can be handy here. I am using the example arrays from the categorized answer How can I find the union/difference/intersection of two arrays? Just replace @simpsons and @females with your arrays.
my @simpsons=("homer","bart","marge","maggie","lisa"); my @females=("lisa","marge","maggie","maude"); my %simpsons_hash; @simpsons_hash{@simpsons} = @simpsons; @female_simpsons = grep {$_} @simpsons_hash{@females};
HTH.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://100033]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (5)
As of 2017-03-26 21:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should Pluto Get Its Planethood Back?



    Results (315 votes). Check out past polls.