A hash is the usual way to improve the efficiency of lookup.
No sorting needed.my @a_not_b = do { my %b; @b{@b} = (); grep { not exists $b{$_} } @a; };
After Compline,
Zaxo
In reply to Re: most efficient way to implement "A without B"
by Zaxo
in thread most efficient way to implement "A without B"
by telcontar
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |