Perl-Sensitive Sunglasses | |
PerlMonks |
Parsing a Log Fileby PrimeLord (Pilgrim) |
on Nov 29, 2004 at 18:41 UTC ( [id://410999]=perlquestion: print w/replies, xml ) | Need Help?? |
PrimeLord has asked for the wisdom of the Perl Monks concerning the following question:
Hello Monks. I am here seeking your wisdom once again. I am trying to develop a program to read a log file generated by a football sim. I would like the program to compile a stastical breakdown for each player. Things like per quarter and per half stats as well as down and distance stats etc. I am having trouble determining the best way to attack this though. Below is an excerpt from one of the log files.
I need to parse the lines to determine what type of play it was, who was involved, what the down and distance was etc. That isn't too difficult however the lines are not always consistent. As you can see some of the lines have additional information than just the play result and who made the tackle, such as who had a key run block. There are also penalties to deal with and the -- indicates a first down. Does anyone have any suggestions on the best way to parse some thing like this? Also what type of data structures should I store the information in. When I had tried to tackle this before I tried slurping all the 1st quarter lines into an array and then the second quarter lines into another array etc as well as creating an array for home games and away games etc, but that didn't seem efficent. Is there a good way using hash of hashes or arrays in hashes to store this information for each player? I apologize if this isn't very clear, but I am just lost as to what the best way to tackle this is. I can try and clarify any thing that I haven't explained well. Any help you can offer would be greatly appreciated. Thanks! -Prime
Back to
Seekers of Perl Wisdom
|
|