my $batch_total = 297; my $batch_sign_indicator = '-'; my $close_response; $close_response->{batch_net_amount} = -2.97; #this code doesn't work. it returns false my $test_batch_amount = ($batch_sign_indicator eq '-') ? ((0 - $batch_total) / 100) : ($batch_total / 100); if($test_batch_amount == $close_response->{batch_net_amount}){ print "good!!! $test_batch_amount == $close_response->{batch_net_amount}"; } else{ print "no good $test_batch_amount == $close_response->{batch_net_amount}"; } ####THIS CODE DOES WORK AS EXPECTED AND RETURNS TRUE my $test_batch_amount = ($batch_sign_indicator eq '-') ? ((0 - $batch_total)) : ($batch_total); if($test_batch_amount == ($close_response->{batch_net_amount}*100)){ print "good!!! $test_batch_amount == $close_response->{batch_net_amount}"; } else{ print "no good $test_batch_amount == $close_response->{batch_net_amount}"; }