Description

Perl is a modern general purpose programming language developed by linguist Larry Wall. (Trivia -- Wall trained with Summer Institute of Linguistics, just like Drs. Chase, Rohrbaugh, and Owen :-).

In this lab you will familiarize yourself with Perl and write some simple programs. As you become more familiar with the features of Perl, it will be a useful backdrop for our conversations about programming language syntax and semantics.

Perl has already been installed on the F366 lab computers. To run a Perl program, type your code in a text file (e.g., using notepad), and save with the suffix *.pl. Here's an example:

Perl Hello World

 

Once it is saved, you can run the program by opening a command line window to the location where you saved it, and run it by typing perl filename.pl

Screenshot of Hello World in Perl

Try it yourself!

Before proceeding, I'd like to provide the following as a 'coding template' -- please use this as the basis for any Perl program you write for this class.

#!/usr/bin/perl 
# @file    filename.pl 
# @author  First Last 
# @version 1.0

use strict; use warnings; use feature ':5.10';

Now that we've gotten the preliminaries out of the way, we can proceed. To introduce Perl, we'll use the following tutorials by Doug Sheppard:

  1. Beginner's Introduction to Perl 5.10 ; also consult www.ebb.org/PickingUpPerl/pickingUpPerl_2.html

    After you complete this part of the tutorial, write a Perl program to print an investment report. Prompt the user for balance, interest rate, and number of months; then print out a table similar to the following. I've also provided an excel workbook demonstrating an investment report.

    Investment Parameters
    ---------------
    Initial Balance: $100000.00
    Rate (APR):       5.5%
    Term in Months:   48
    
    
    Month     Init Bal     Int Earned      End Bal
    -----     --------     ----------     --------
    1         10000.00          54.17     10054.17
    2         10054.17          54.46     10108.63
    3         10108.63          54.76     10163.38 
    ...

    Turn in the following:

    • Incremental releases (at least 2 early releases in addition to the final):
    • all code properly commented
    • all code compiles & runs without error
    • each release implements incremental functionality .
    • screenshot(s) of successful runs
    • RELEASE_NOTES.txt updated and included with each release
    • A lab report that describes your development steps and explains choices you made along the way

Resources FYI

  1. Beginner's Introduction to Perl 5.10 Part 2
  2. Beginner's Introduction to Perl 5.10 Part 3
  3. Formatting Output in Perl
Copyright © 1999-2008| Gene Rohrbaugh | Privacy Statement