in reply to numeric values acting funny
use strict; use warnings; my $payment_total = 415; my $order_total = 420; my $difference = $order_total - $payment_total; print cash($difference); sub cash { $_[0] = int($_[0] + .5); $_[0] /= 100 if $_[0] != 0; return sprintf('$%.2f', $_[0]) }
|
|---|