sub check_price_paid { my $price_paid = param("some_param"); my $price_to_pay = &calculate_price; return $price_to_pay <= $price_paid; # This is where we get problems!! } sub calculate_price { my $price = &calculate_base_price; $price += &calculate_tax($price); return $price; } sub calculate_base_price { my $price = 0; foreach (@item) { $price += $_ -> price; } return $price; # this will always be to 2 sig figs. } sub calculate_tax { my $price = shift; my $tax; $tax = $price * $CONFIGS->{tax} / 100; # need to be accounting correct $tax *= 10 ** $currency_decimal_places; if ($tax =~ /\.(\d)/ && $1 >= 5) { $tax ++} # a cheat, but simple. This rounds up or down, in accounting-correct manner. $tax = int $tax; $tax /= 10 ** $currency_decimal_places; return $tax; }