max1x, it looks like that the code shown will add the element as long as the $newArray[0] does not equal to $array[4].
The following code should work, perhaps a little awkward.
# add fifth element if not a double in @newArray
my @array=(1,4,7,10,11);
my @newArray=(2,5,6,7,8,10,9);
my...