I am new to Perl below is my script for comparing two text files(LEAP_O.txt,VLDB_O.txt) and printing the difference. pattern matching is working in the first occurrence. Could you please guide me where i am going wrong. Dealing with data of a-z series,some series contain more than 500 lines. below given my sample input from o series and the script. my requirement is need to print the difference at the same time for some criteria need to ignore.

I am not sure that I understand your question. I think that you believe that your script works correctly on the posted data files. You want to generalize the script to process all files with names matching the pattern LEAP_?.txt. Search the directory for this pattern with glob (refer: perldoc -f glob) Good Luck, Bill