# create data for small summary table of all retailers my $numWks = (($num_days - ( 7 - $firstDOW_curMonth )) / 7 ) + 1; if ( (($num_days - ( 7 - $firstDOW_curMonth )) % 7 ) ) { $numWks++; } my @summary[$numWks][7]; # !!! uh-oh this does not Perl-ize !!! # init the blank portion of $summary[][] if there is one my $temp = 0; while ( $temp < $firstDOW_curMonth ) { $summary[0][$temp++] = "--"; } my $wktotal; my $count=1; my $firstDOW = $firstDOW_curMonth; for ( my $wk = 0; $wk < $numwks; $wk++ ) { $wktotal = 0; for ( my $dw = $firstDOW; $dw < 7; $dw++ ) { $summary[$wk][$dw] += $total_opd{$count}; $wktotal += $total_opd{$count}; last if ($count++ == $num_days); } $firstDOW = 0; $summary[$wk][$7] = $wktotal; last if ($count > $num_days); }