Programming Assignment #1: Perl

Due: Monday, October 6th, 8AM

 

In this assignment you will be writing a suite of perl programs. Each program will be performing a different useful task. The purpose of writing a suite of programs is for you to see how Perl can be used in various capacities.

 

Program 1: hello (30 pts)

Modify the hello.pl file to do the following:

1.     Output a special message when the secret word is entered properly

2.     Only allow the user to try entering the secret word correctly 3 times. On the 3rd incorrect time, the program should exit with an error message to the user.

3.     After the user is successful entering the secret word or “Randal”, ask if they would like to play again. If “yes” restart the program, if “no” then thank them for playing and exit

Program 3: qmail (75 points)

qmail is short for "Quick Mail". This program is used for sending mail to a friend, when you just want to send a quick note. It also keeps a database of names and e-mail addresses. This should be a menu driven program:

1.     add a name

2.     lookup a name

3.     delete a name

4.     send mail by name

5.     quit

The add name option should prompt the user for the name of the person. Then it should prompt the user for the persons e-mail address. Then it should store the name and e-mail address into a database(hint: both the name and e-mail address are strings).

The lookup name option should prompt for a string or regexp and display all entries in the DB that match. The match should work on e-mail addresses as well as names. After presenting a list of matches, the user should have the option of sending mail to a user.

The delete name option should prompt for a string or regexp and display all of the matching entries. Then allow the user to delete entries.

The send mail by name operation should take a string that is the persons name, and if the name has a corresponding e-mail address prompt the user for a subject. Then ask the user to enter the contents of the message. Here is an example of the interaction:

enter your subject: Hello Friend

start entering your message(type send on a line by itself to send the message)

Hi Friend,

 

How are you?

 

Bye Now

send

Your message has been sent to friend@usa.net

After any menu option is selected and carried out, you should redisplay the menu.