use Set::Array; ... my $set_a = Set::Array->new(@a); my $set_b = Set::Array->new(@b); my @c = $set_a->difference(@set_b);