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