my %temphash; @temphash{@array1, @array2} = (); my @mergedkeys = keys %temphash