There was actually flow in my logic.. so I corrected and works now
I still don't understand why eval { } || 0 did not work though
for (sort keys %totalcalls)
{
my $start_i_f = ($start{$_}) ? $start{$_} : 0;
$report_stop{$_} = sprintf("%.2f", ( ( $stop_inbound{$_} / 60000 ) / $stop{$_})) if $stop_inbound{$_};
if (defined $crank{$_}) {
$report_ccr{$_} = sprintf("%.2f" , ( ( $start_i_f / ($totalcalls{$_} - $crank{$_}) ) * 100 ));
$report_asr{$_} = sprintf("%.2f" , ( ( $start_i_f / $totalcalls{$_}) * 100 ));
} else {
$report_asr{$_} = sprintf("%.2f" , ( ( $start_i_f / $totalcalls{$_}) * 100 ));
}
}
| [reply] |
>perl -we"my $x; my $q = eval { $x / 4 } || 0;
Use of uninitialized value in division (/) at -e line 1.
>perl -we"my $x; my $q = eval { ($x||0) / 4 };
>perl -we"my $x; my $q = ( $x / 4 ) || 0;
Use of uninitialized value in division (/) at -e line 1.
>perl -we"my $x; my $q = ( ($x||0) / 4 );
| [reply] [d/l] [select] |
I was wish eval can wrap even the warnings but I guess that's not the purpose of the eval
Do you guys normally run perl scripts that's written for production w/out -w ?
I don't think having people seeing perl warning message is professional looking.. that's just my opinion
| [reply] |