#!/usr/bin/perl

# You can retrieve Set::Bag from http://www.perl.com/CPAN/modules/by-module/Set.
use Set::Bag;

my $my_bag   = Set::Bag->new(apples => 3, oranges => 4);
my $your_bag = Set::Bag->new(apples => 2, bananas => 1);

print $my_bag | $your_bag, "\n";                # Union (Max)
print $my_bag & $your_bag, "\n";                # Intersection (Min)
print $my_bag + $your_bag, "\n";                # Sum

$my_bag->over_delete(1); # Allow to delete non-existing members.

print $my_bag - $your_bag, "\n";                # Difference
