in reply to Extract the lines

How about using something like Apache::Parselog?

I searched for “Apache log” on CPAN and found a nice number of hits to interesting-looking packages.   I always strongly encourage folks to look first at CPAN before venturing any distance at all down any “primrose path.”

“Two paths diverged in a wood, and I ...
... found that CPAN had already been hundreds of times before down both of them.”