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

Re: Arrays and Hashes Mapping

by pingo (Hermit)
on Dec 08, 2004 at 11:15 UTC ( #413152=note: print w/replies, xml ) Need Help??


in reply to Arrays and Hashes Mapping

If I understand you correctly, perhaps something like this:

@list = ('one' , 'two' , 'three'); %hash = ( one => 1 , two => 2 , three => 3 ); @list = grep { !$hash{$_} } @list;

Replies are listed 'Best First'.
Re^2: Arrays and Hashes Mapping
by kappa (Chaplain) on Dec 08, 2004 at 12:17 UTC
    Better use exists here, so that ( zero => 0, empty => '' ) won't give you false positives:
    @list = grep { !exists $hash{$_} } @list;
    --kap

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://413152]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (5)
As of 2020-06-03 07:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you really want to know if there is extraterrestrial life?



    Results (21 votes). Check out past polls.

    Notices?