in reply to Interlaced log parser
Individual transactions should probably not be stored in an array, since there is no easy way to find the stored transaction data when you next see a log line about it, and need the info.
If you have unique identifiers for each transaction (which you must), and they are not simple small sequential integers (which I'm sure they aren't), then a hash is the way to go.
For example, you could scan through the log, and everytime you see an event for transaction $Tname, you reference $transactions{$Tname}, to find your notes on what you have seen about it so far.
A hash of hashes of (scalars with a few lists mixed in) would be what I expect. Something like:
Note: $transactions{transactionOne}{endTime} being undef, since you haven't seen the end yet, and do not know what the value should be.$transactions = { transactionOne => { startTime => 123, userName => 'Bob', endTime => undef, foosMunged => [1, 5, 99], } transactionTwo => { ... } };
Fill in the transaction data as you see it, and once you see the end of a transaction, you can do whatever you need to do with the data you've collected, then delete the hash entry or leave it for later (Given huge files, deleting the old info is probably best). By the time one transaction ends, a few others will be partially populated, but stored safely out of the way behind their own ID keys.
|
|---|