Does someone know of a good way to count total records for the week? I can get total for day and month, but the week totals fail, returning 0 (for some reason they work when I execute the program from the shell). I've shown below snippets of the code and subroutine, sorry for the long post. If anyone knows of some good examples of this, I'd like to see it. Thanks for any help!
I've got several records that look like this (yyyymmddhhmmss): 20011217222520 12/17/2001 22:25:20 @@@ book1 20011217233008 12/17/2001 23:30:08 @@@ book2 20011217235524 12/17/2001 23:55:24 @@@ inseh I'm trying to use this part: 20011217235524, for calculating total number of records for day, week, and month. Here's part of the application: my ($tsec,$tmin,$thour,$mday,$tmon,$tyear,$wday,$yday,$isdst) = localtime(time); my $year = $tyear + 1900; my $month = sprintf("%02d", $tmon + 1); my $day = sprintf("%02d", $mday); my $hour = sprintf("%02d", $thour); my $min = sprintf("%02d", $tmin); my $sec = sprintf("%02d", $tsec); my @idx = qw(book1 book2 book3 inseh); ## After opening log file and pushing all the lines with @@@ into the proper array: &sortdates(0,@amk); sub sortdates(\$,\@) { my ($inthub,@hub) = @_; my $total = 0; my $ytotal = 0; my $mtotal = 0; my $wtotal = 0; my $dtotal = 0; my $i; my $j; my $hubname = $longarray[$inthub]; for (0..$#idx) { foreach $hubentry (@hub){ if ($hubentry =~ (/($idx[$_])/io)) { $total++; $i = $wday; $j = 0; if ($hubentry =~ (/($year)(\d{10})/o)) { ++$ycount; if ($hubentry =~ (/(\d{4})($month)(\d{8})/o)) { ++$mcount; if ($hubentry =~ (/(\d{6})($day)(\d{6})/o)) { ++$dcount; } while ($i >= -1){ # count down from current weekday number # until $j = $mday - $i; if ($hubentry =~ (/(\d{6})($j)(\d{6})/o)) { ++$wcount; } --$i; } } } } } print "<tr><td width=100>$idx[$_]</td><td align=center width=100><b>$dcount</b></td><td align=center width=100><b>$wtotal</b></td><td align=center width=100><b>$mtotal</b></td><td align=center width=100><b>$total</b></td></tr>"; $total = 0; } -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]