in reply to Merging Arrays without duplicates

If this isn't homework, then using Set::Array might save you a lot of time.