my %in_b; undef @in_b{ @b }; my @c = grep !exists $in_b{ $_ }, @a;