$fee = determine_maximum_fee();
sub determine_total_fee {
Refactoring error? Is it determine_
maximum_fee() or determine_
total_fee? And that name that is overly verbose.
$fee = ($tfee / 100 + $sfee/100 + 0.0000001) * 100
...what in the world is this doing? If I had to guess, I'd say it is a hack to misuse
floating point numbers, instead of using something like
Math::Currency, although I'd expect to see some calls to int(). And it diddles with global variable $foo.
$mfee = 200 if ($fee >= 100);
...refers to global variables $mfee and $fee. And $mfee is non-descript. And we should at least have a comment explaining the magic numbers 100 and 200.
$fee = $mfee if $mfee;
...this is seems like it is probably a horrible hack to avoid warnings about undef.
return $fee;
}
I'd probably
not refactor into a subroutine, instead using a proper data type and something like...
use constant BREAK_POINT => 100;
use constant BONUS_FEE => 200;
my $total_fee = $tfee+$rfee >= BREAK_POINT ? BONUS_FEE : $tfee+$rfee;
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.