$sth->execute(); while (my $row = $sth->fetchrow_hashref ){ push @newRow, $row; $gt_cdrs = $gt_cdrs + $row->{"col4"}; $gt_hold_time=$gt_hold_time + $row->{"col5"}; if ($row->{"CALL_STATUS"} eq "S" || $row->{"CALL_STATUS"} eq "R" || $row->{"CALL_STATUS"} eq "I") { $gt_duration = $gt_duration + $row->{"col6"}; } else { $gt_errs = $gt_errs + $row->{"col4"}; } $gt_calls = ($gt_cdrs - $gt_errs); ################################# if (($hold_col_val1 ne $row->{"id"}) || ($hold_col_val2 ne $row->{"col2"}) || ($hold_col_val3 ne $row->{"col3"})) { unless ($hold_col_val1 eq "~~~") { ## calculate percentages $ASR = (($total_cdr_count-$total_error_count) / $total_cdr_count) * 100; if (($total_cdr_count-$total_error_count) > 0) { $avgPDD = $good_hold_time / ($total_cdr_count - $total_error_count); $avgDUR = $good_duration / ($total_cdr_count - $total_error_count); } else { $avgPDD = 0; $avgDUR = 0; } $minutes = $good_duration / 60; if($asr_scrn ne "") { if( ($asr1 ne "" ) && ($asr2 eq "") ) { if ($ASR > $asr1) { goto EXTCHK1; } } if( ($asr1 ne "" ) && ($asr2 ne "") ) { if ( ($ASR < $asr1 ) || ($ASR > $asr2+1) ) { goto EXTCHK1; } } } $formatASR = sprintf("%3.0d",$ASR); $formatPDD = sprintf("%3.0d",$avgPDD); $formatDUR = sprintf("%3.0d",$avgDUR); $formatMin = sprintf("%4.1f",$minutes); } $counter++; $hashData{'counter'} = $counter; $hashData{$counter}{'id'} = $hold_col_val1; $hashData{$counter}{'col2'} = $hold_col_val2; $hashData{$counter}{'col3'} = $hold_col_val3; $hashData{$counter}{'col4'} = $total_cdr_count; $hashData{$counter}{'col5'} = $total_call_count; $hashData{$counter}{'col6'} = $total_error_count; push @output, \%hashData; #print $hashData[$counter]{'id'}." ".$hashData[$counter]{'col6'}."\n"; }