Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: Arrays and Hashes Mapping

by pingo (Hermit)
on Dec 08, 2004 at 11:15 UTC ( [id://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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://413152]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (2)
As of 2024-04-20 04:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found