|Do you know where your variables are?|
Re: Re: virus log parserby rincew (Novice)
|on Jul 02, 2002 at 21:56 UTC||Need Help??|
I would like to add some random thoughts I had when I saw your code.
First of all, the construct
can be expressed very succinctly using so called hash slices, i.e.
See for example this for a good introduction.
Furthermore, why do you use a hash reference to store the data when a hash would be sufficient? (This is probably a matter of style.)
Then, I usually consider multiple repeated lines with trivial differences like
to be a sign that some kind of abstraction like a loop is needed. In this case, keying each datum by its header field
does so and furthermore removes the need to spell out the interesting header fields several times. This of course means that unknown fields like the Date: are ignored, but your code ignores them as well.
So finally here is my attempt at implementing your algorithm: