in reply to Re^2: comb a logfile for time diff and occourance
in thread comb a logfile for time diff and occourance

Thanks for catching the typo, I've corrected the original post.

You are right to some extent, I'd missed the bit about identical refs. However the specs aren't clear and it is not obvious what the OP really wants to report.

A modification of the code to

while ( my $line = <$file> ) { next unless $line =~ /TWO/; my ($time, $ref) = $line =~ /^(\d\d\d\d-\w\w\w-\d\d \d\d)/).*refs += (\d+)$/; ++$stats{$time}{$ref}; }
may suffice. It will keep a count of how many times each ref number occurs during each hour. Typically data is reported over fixed intervals of time and this approach certainly has the advantage of simplicity.

Replies are listed 'Best First'.
Re^4: comb a logfile for time diff and occourance
by CountZero (Bishop) on Feb 18, 2008 at 13:25 UTC
    "Lack of clear specifications" is probably the worst part of having to implement something for someone else. Rarely they have a clear view of what they want, but that of course will not stop them from changing their targets and blaming the programmers if projects overrun their allowed budgets of time and money.

    CountZero

    A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James