in reply to match two files
How I can shorter the running time by change some code?
Although it's hard to spot because of the random indenting, you have a pair of nested loops. Inside the inner loop you have this line:
which serves absolutely no purpose. The first change you should make is therefore to remove this line.
Then you might look at your algorithm. Why are you doing the same processing on the entries in @lines2 over and over again? Just process it once, pop the results in a hash for fast lookup and your code will whizz.
Three more tips:
- use strict
- use warnings
- pick an indentation scheme and stick to it. perltidy can help to enforce this.