Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Idiom: hashes as sets

by w-ber (Hermit)
on Jul 02, 2008 at 18:21 UTC ( #695171=perlmeditation: print w/ replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
      my %set = ();
      my @new_items = ...;
      @set{@new_items} = (1) x @new_items;
    
  2. or download this
      delete @set{@other_items};
    
  3. or download this
      # Difference.
      sub difference {
    ...
        @symm{@set1, @set2} = (1) x (@set1 + @set2);
        \%symm;
      }
    

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (12)
As of 2015-07-07 22:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (93 votes), past polls