# Perl Program Update

Please apply the following formula below to the program so it works correctly!

The following formula is used to calculate the fixed monthly payment (P) required to fully amortize a loan of L dollars over a term of n months at a monthly interest rate of c. [If the quoted rate is 6%, for example, c is .06/12 or .005].

P = L[c(1 + c)n]/[(1 + c)n - 1]

I am currently getting the following errors

Number found where operator expected at calc.cgi line 38, near "#P = Lr(1+r/1200"

(Might be a runaway multi-line // string starting on line 15)

(Do you need to predeclare P?)

Unquoted string "n" may clash with future reserved word at mor_calc.cgi line 38.

Unquoted string "r" may clash with future reserved word at mor_calc.cgi line 38.

Unquoted string "n" may clash with future reserved word at mor_calc.cgi line 38.

Scalar found where operator expected at mor_calc.cgi line 39, near "$num_months"

(Missing semicolon on previous line?)

syntax error at mor_calc.cgi line 38, near "P = Lr(1+r/1200"

Missing right curly or square bracket at mor_calc.cgi line 61, at end of line

Execution of calc.cgi aborted due to compilation errors.

Thank you!

© BrainMass Inc. brainmass.com October 9, 2019, 8:25 pm ad1c9bdddfhttps://brainmass.com/computer-science/perl/perl-program-update-150301

#### Solution Preview

Dear Student,

I have modified the script and named new_mor_cal.pl to follow the new formula given above. Please follow the following instructions on usage of this program.

usage: perl new_mor_calc.pl -L 20000 -y 15 -i 12

-L amount : Amount of loan.

-y years : Number of years

-i interest : Percent per year interest.

-h ...

#### Solution Summary

The following formula is used to calculate the fixed monthly payment (P) required to fully amortize a loan of L dollars over a term of n months at a monthly interest rate of c. [If the quoted rate is 6%, for example, c is .06/12 or .005].

P = L[c(1 + c)n]/[(1 + c)n - 1]

I am currently getting the following errors

Number found where operator expected at calc.cgi line 38, near "#P = Lr(1+r/1200"

(Might be a runaway multi-line // string starting on line 15)

(Do you need to predeclare P?)

Unquoted string "n" may clash with future reserved word at mor_calc.cgi line 38.

Unquoted string "r" may clash with future reserved word at mor_calc.cgi line 38.

Unquoted string "n" may clash with future reserved word at mor_calc.cgi line 38.

Scalar found where operator expected at mor_calc.cgi line 39, near "$num_months"

(Missing semicolon on previous line?)

syntax error at mor_calc.cgi line 38, near "P = Lr(1+r/1200"

Missing right curly or square bracket at mor_calc.cgi line 61, at end of line

Execution of calc.cgi aborted due to compilation errors.