use Set::Scalar; my $bigset = Set::Scalar->new(@bigarray); my $smallset = Set::Scalar->new(@smallarray); my $difference = $bigset - $smallset;