Help for this page

Select Code to Download


  1. or download this
    Use a hash. Here's code to do both and more. It assumes that each elem
    +ent is unique in a given array:
    
    ...
            push @{ $count{$element} > 1 ? \@intersection : \@difference }
    +, $element;
        }
    Note that this is the symmetric difference, that is, all elements in e
    +ither A or in B but not in both. Think of it as an xor operation.
    
  2. or download this
    $_=$,=q,\,@4O,,s,^$,$\,,s,s,^,b9,s,
    $_^=q,$\^-]!,,print