http://www.perlmonks.org?node_id=446271


in reply to most efficient way to implement "A without B"

A hash is the usual way to improve the efficiency of lookup.

my @a_not_b = do { my %b; @b{@b} = (); grep { not exists $b{$_} } @a; };
No sorting needed.

After Compline,
Zaxo