while (@row = $sth->fetchrow_array ){ ($host,$pol,$sched,$date,$target,$error)=@row[0,1,2,3,4,5]; $cutover=(split /:/,$time)[0]; if ($date=~/\s(\d{2})/){ $hour=$1; } #print "========= CUTOVER: $cutover DATE: $date HOUR: $hour ========\n"; if ($hour > $cutover){ ## 12 hours are added to push the backup into the new reporting window (next day) $date=DateCalc("$date","+24 hours"); ###Takes 2min out of 2:30min. $date=&UnixDate($date,"%Y-%m-%d"); #print" This backup has moved to the next day: $date\n"; }else{ $date=(split /\s/,$date)[0]; #print" This backup has stayed: $date\n"; } if (defined ${$report{$host}{$pol}{$sched}{$date}}){ ${$report{$host}{$pol}{$sched}{$date}}=${$report{$host}{$pol}{$sched}{$date}}+$error; }else{ ${$report{$host}{$pol}{$sched}{$date}}=$error; } } }