#!/usr/local/bin/perl @m = ("Foo","Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec", "B/W"); print <Prepayment Mortgage Reduction

Prepayment Mortgage Reduction

Header read(STDIN,$arglist,$ENV{'CONTENT_LENGTH'}); if (length($arglist) < 3) { print< This form allows you to see how prepaying your mortgage reduces the length of your mortgage by putting in the current values for your loan. If you know your current principle balance and principle/interest payment, enter then in fields A1 and A2. Otherwise enter the three values for your loan in B1, B2 and B3. (Original Loan Amount, Month of First Payment, Length of Loan).

Change these fields as desired:

Choose the Option:
A1. Current Principle Balance (if known)
A2. Current Prin+Int Monthly Payment
B1. Original Principle Balance (otherwise)
B2. Month of First Payment (otherwise) -
B3. Length of Mortgage (Years)
You fill out the following table for both cases:
Current Annual Interest Rate
Additional Monthly Pre-Payment*
Increase Monthly Payment each year by (%)

* = Enter B here to do a biweekly conversion from here.

EOF exit; } @iv = split("&",$arglist); for ($i=0; $i<=$#iv; $i++) { ($key,$val) = split("=",@iv[$i]); $aa{$key} = $val; } if ($aa{H} eq "B") { $tt = $aa{L} * 12; $mi = $aa{I} / 1200; $temp = (1.0 / (1 + $mi) ** $tt); if ($temp < 1) { $aa{P} = sprintf("%6.2f", $aa{O} * $mi / (1 - $temp)); } else { $aa{P} = sprintf("%6.2f", $aa{O} / $tt); } print "

Your Monthly Payment (excl. Tax & Insur.) is \$ $aa{P}

\n"; $dt = `date`; ($wd,$mo,$dy,$tm,$tz,$cy) = split(" ",$dt); $cm = (index("JanFebMarAprMayJunJulAugSepOctNovDec",$mo)+3)/3; $ps = $cy * 12 + $cm - $aa{Y} * 12 - $aa{M} + 1; $start = $aa{O}; for ($i = 0; $i < $ps; $i++) { $start = $start - $aa{P} + ($start * $mi); } $aa{B} = sprintf("%12.2f",$start); print "

Since Your First Payment was in $aa{M} / $aa{Y} , "; print "You have made $ps payments so "; print "your balance ($cm / $cy ) has changed from \$ $aa{O}\n"; print "to \$ $aa{B}

\n"; } if ($aa{A} eq "B") { $tot = $aa{P}; $bw = $aa{P}/2; print <Starting with \$ $aa{B} at $aa{I} % and a payment of \$ $aa{P}

Using a biweekly schedule means
two extra principal payments a year of \$ $bw

ResHeaderB } else { $tot = $aa{P} + $aa{A}; print <Starting with \$ $aa{B} at $aa{I} % and a payment of \$ $aa{P}

Paying an extra \$ $aa{A} a month (\$ $tot/month total) means:

ResHeader } $mi = $aa{I} / 1200; if ($aa{X} > 0) { $inc = (1 + $aa{X} / 100); print "

Each year the Monthly Payment will increase by $aa{X} %

\n"; } print "\n"; print "
Month(Year)BalancePaymentInterestPaid Principle\n"; # Amortize it while ($aa{B} > 0 && $m < 1200) { $m++; $intv = $aa{B} * $mi; $intt = $intt + $intv; $pp = $tot - $intv; $aa{B} = $aa{B} - $pp; printf ("
%3d %5.2f %9.2f %9.2f%9.2f %9.2f\n", $m, $m/12, $aa{B}, $tot, $intv, $pp); if ($aa{A} eq "B") { $c6++; if ($c6 == 6) { $bw = $tot/2; $aa{B} = $aa{B} - $bw; $c6 = 0; printf ("
BW - %9.2f %9.2f - %9.2f\n", $aa{B}, $bw, $bw); } } $c12++; if ($c12 == 12 && $inc > 1) { $tot = $tot * $inc; $c12 = 0; } } $ys = sprintf("%5.2f",$m/12); print <

So your loan will terminate in $m months ($ys years)


NOTE: Make sure prepaying is really the best alternative for you! Check out prepayment versus investing comparison for more info. And for goodness sakes, pay off all your high interest credit cards and car loans before even considering prepaying your mortgage. Trailer