map($a1{$_}=1,@a1); # create %a with elements from @a1 @a2=grep(!defined($a1{$_}),@a2); # returns those elements of @a2 that don't # have a hash element in %a1 therefore they # do not exist in @a1.