Create a Compound Interest Calculator in Perl

Open a text editor, for example, NotePad, and enterSave the script as interest.pl. Make a note of the
the following lines of code:directory/folder where you have saved it.
#!/usr/bin/perl -wprint "Monthly deposit: "; # prompt forRunning the script
inputYou need to run the script from a command line
$deposit=; # get input from keyboardchomp $deposit;prompt, so open a terminal window/MS-DOS prompt.
# remove the newline character from the end of theChange to the directory/folder where the interest.pl file
variableprint "Interest rate (3, 4, 5.5, etc): "; # prompt foris located, and type the following command:perl
inputinterest.pl
$interest=; # get input from keyboardchomp $interest;When prompted, enter the monthly deposit, interest
# remove the newline character from the end of therate, and the number of months that the money is
variabledeposited.
# Change interest from 3, 4, 5, etc to .03, .04, .05, etcError messages
$interest=$interest*.01;If the script did not work, you probably received one of
# Change interest to a monthly multiplierthe following error messages:
$interest=$interest/12;print "No of months: "; # prompt- 'Bad command or filename' or 'command not found'.
for inputThis means that Perl has not been added to the
$nMonths=; # get input from keyboardchompPATH variable. See your operating system help
$nMonths; # remove the newline character from thedocumentation for information on how to fix this
end of the variableproblem.
# The interest calculation- 'Can't open perl script interest.pl: A file or directory
$total=$deposit * (((1 + $interest) ** $nMonths) -1 ) /does not exist'. This probably means that you are not
$interest;print "After $nMonths months you will have ain the folder/directory where you saved the script, in
total amount of $total";which case you should change to the correct location.
(Note: the spaces on either side of STDIN are for- If you get a syntax error, it probably means you
display purposes only in this article. In your script, youhave mis-typed the contents of the file. Open the file
can omit them.)and fix any mistakes.