Topic: How to find and remove duplicates

Let`s say I have a file with a list of names and some of them appear multiple times.
How do I find and remove duplicates from that list?

I know that I have to read the file, create a array, do each_line, compare results and delete if there`s a match.

Just can`t quite grasp how to do that last part.

Would appreciate any guidance.

Re: How to find and remove duplicates

the Array class contains the 'uniq' and 'uniq!' methods to remove duplicated. See more info at http://ruby-doc.org/ruby-1.9/index.html

Re: How to find and remove duplicates

Thanks a milion!
Never even though about checking... .

P.S

Any clue how to parse links just to get the subdomains, knowing that the root domain won`t change?

I`ve looked into URI but it seems like a overkill.