in reply to Set intersection problem
If you don't care about which sets an item belongs to, and there are no duplicates within any set:
#!/usr/bin/perl use strict; # https://perlmonks.org/?node_id=11152381 use warnings; my %sets = ( A => [1,2,3], B => [3, 4], C => [1, 3, 4] ); my %seen; my @items = sort grep $seen{$_}++ == 1, map @$_, values %sets; print "Items in more than one set: @items\n";
Outputs:
Items in more than one set: 1 3 4
|
|---|