## use hash search to find everyone in @a but not in @b. my %temphash = map { $_ => 1 } @b; my @c = grep { !$temphash{ $_ } } @a;