Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: set theory w/hashes? arrays? done quickly?

by Fastolfe (Vicar)
on Oct 03, 2000 at 21:51 UTC ( [id://35154]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    foreach $e (@a, @b) { $union{$e}++ && $isect{$e}++ }
    
    @union = keys %union;
    @isect = keys %isect;
    
  2. or download this
    @diff = ();
    foreach $e (keys %union) {
       push(@diff, $e) unless $isect{$e};
    }
    
  3. or download this
    $s = new Set::Scalar (keys %hash1);
    $t = new Set::Scalar (keys %hash2);
    
    @isect = $s->intersection($t)->members;
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (4)
As of 2024-04-19 03:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found