Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re^3: Using hashes for set operations...

by ikegami (Patriarch)
on May 22, 2011 at 05:18 UTC ( [id://906117]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Using hashes for set operations...
in thread Using hashes for set operations...

Sorry, missing map { $_ => 1 }

my %set1 = map { $_ => 1 } @array1; my %set2 = map { $_ => 1 } @array2; my %intersection = map { $_ => 1 } grep $set1{$_}, keys %set2;

and you missed so many points from my post that I assume that you only read the headings..

Are you trying to imply that I should have told you you need to use a hash to get the original from the stringification even you already know that?

Or are you referring to request to avoid loops? Yeah, I missed that bit of nonsense. It's impossible to find the intersection of two sets without looping over the two sets.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (3)
As of 2024-04-25 06:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found