in reply to optimization in file processing

Read perlperf. Follow its advice, most importantly about profiling (Devel::NYTProf).

If the code is not too long, you can also post it here, maybe somebody can spot an obvious bottleneck.