in reply to storing data in a hash

From what you write it is not very clear to me what you want to do.

Does the log file span a day change?

If so, is it, that given queries reflected in the logfile as for the following graph

day 1 | day 2 ---- | -------- | -------| ----|-- -----|-- ----|--- --|---- |------ | -------
you want to divide the data amount between the days and sum them up foreach date?

Or is the the logfile always either one day or the other?

In either case, use Time::Local. When does the script run? I assume the script runs roughly at any time between 20:30:00 and 03:00:00. Make a UNIX timestamp of the day change with

my @now = localtime; my $hour = $now[2]; $now[$_] = 0 for 0..2; # set hour, min, sec to 0; $daychange = timelocal(@now); # add one days seconds if running before midnight $daychange += 86400 if $hour > 2;
Then you can compare the timestamp in the second field of your rows to that timestamp and sum it to the right day sum:
$sum{ $daystamp <= $stoptime ? 'first' : 'second' } += $linesum;
Voila, you have the sum of one day in $sum{'first'} and of the next day in $sum{'second'}, now you can insert into your database whichever of the two contains data. If the log file spans days, you could split the amount of bytes according to the second before and after a days shift foreach row.


_($_=" "x(1<<5)."?\n".q/)Oo.  G\        /
                              /\_/(q    /
----------------------------  \__(m.====.(_("always off the crowd"))."
");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}