Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: Parsing Logs

by moritz (Cardinal)
on Oct 05, 2012 at 16:59 UTC ( #997516=note: print w/ replies, xml ) Need Help??


in reply to Parsing Logs

I'm having trouble with the foreach within a foreach loop. I can't figure out how to do this effectively.

The trick is not to use two nested loops. Instead use the session ID as a key in a hash, and then when interating through @array, extract the session ID from each line, and check if the session ID exists in a hash. That should reduce the runtime from O(@array * @sessionID) to something more along the lines of O(@array + @sessionID).


Comment on Re: Parsing Logs
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://997516]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (10)
As of 2015-05-26 12:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    In my home, the TV remote control is ...









    Results (500 votes), past polls