http://qs321.pair.com?node_id=11117636


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:

$i++

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:

Good luck.