Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

Perl : read a file and output only distinct lines (eliminate all duplicates)

Avatar of cantthinkofone
cantthinkofoneFlag for United Kingdom of Great Britain and Northern Ireland asked on
4 Comments1 Solution742 ViewsLast Modified:
I have a file which has content something like the following:

01 A line of text
02 Another line of text
03 Yet another one
01 A line of text
04 More text
02 Another line of text
01 A line of text

How do I read this file and output, to another file, only the "unique" rows, ie:

01 A line of text
02 Another line of text
03 Yet another one
04 More text

is this easy to do in a Perl script?

As always, any help much apprfeciated!