I have thought about this for 20 seconds. Since your solution disregards order and count, it seems that this can be generalized into saying "this set can't have any members that are in that set". If I were putting this into a module, I would likely use a tied interface to the 3 main data types (hashes, arrays, scalars).
tie my $string 'Set::Avoid', not => 'this';
$string = "This is how you do it";
print $string; #T ow you do"
It should be obvious how this would work for arrays and hashes but you would run into problems with scalars if they ended up being references.