sub perlfaq { my %hash; @hash{@array2} = ((undef) x @array2); @array1 = grep { not exists $hash{$_} } @array1; }