This is covered in the FAQ perlfaq.
In reply to Re: Removing duplicate array elements by jasonk in thread Removing duplicate array elements by kumar