Your question is lacking in some information. By matching lines do you mean duplicate lines in the file, or lines that match a string you have in mind? Since you have not posted any code I would suggest having a read at some of the sites fine Tutorials, in particular File Input and Output, along with the PerlMonks FAQ, and How do I post a question effectively? if you have not already done so.