Your correct in saying your code finds elements which are only in one of the sets. But the OP asked for an implementation to find the difference of two sets. Your code only finds the difference when @badstuff is a subset of @goodstuff.
A solution:
my %result; @result{ @goodstuff } = (); delete @result{ @badstuff }; my @result = keys %result;
In reply to Re^2: Subtracting Lists
by ikegami
in thread Subtracting Lists
by JimSki
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |