in reply to Adding the duplicate data using arrays
Why do you want to use an array? The natural thing when you hear duplicate or unique is to think of hashes.
With that, use the following approach:
That's all. Not too hard, isn't it?! ;-)