|
|
|
Your skill will accomplish what the force of many cannot |
|
| PerlMonks |
how to make a regex loop efficient?by mavili (Initiate) |
| on Oct 16, 2012 at 03:23 UTC ( #999209=perlquestion: print w/ replies, xml ) | Need Help?? |
|
mavili has asked for the
wisdom of the Perl Monks concerning the following question:
Hi monks, i've got the code below and it takes ages (>40 seconds) to run. I'm looking for ways to make it more efficient if possible. The array @files is around 450 elements, and the file LOG is a large file containing tens of thousands of lines, which is then read into the string $log (this is faster than iterating through the lines of LOG):
Can anyone suggest some improvements please? EDIT: problem solved. I was doing it completely wrong by putting the log file into a string. the solution was to go through the logs in a loop HOWEVER in a different way. solutin is more or less outlined below:
LOG file is an HTTP access log and the regex above matches HTTP requests for .pdf file types. So the following will have been a successful match and would be incremented in the hash.
Back to
Seekers of Perl Wisdom
|
|
||||||||||||||||||||||||||