CSE 341 -- Programming Languages

Autumn 2001

Department of Computer Science and Engineering, University of Washington

Steve Tanimoto (instructor)

Assignment 7

Version 1.0 of Dec. 3. (Subject to Change)

Perl Poem 

Due date and time: Wednesday, December 12 2001 (at the beginning of class).

Turn-in instructions: hard copy plus online files.


 

Title: Perl Poem

Purposes: To work with Perl and CGI programming, including the use of HTML forms and Perl regular expressions.

Instructions: Read Chapters 1 through 9 in Sebesta's A Little Book on Perl.
 
Part A: HTML
Create a web page containing an HTML form where a web surfer can enter her/his name and click on a button to submit it.
 
Part B: Perl
Write a Perl program that will be activated when the web surfer submits her/his name via your form. The program will produce a web page that contains a poem based upon the information provided by the user. Your program should do the following.

  • Get the user's name. (You may use full name in one text field, in 3 text fields, or only first name in one text field.)
  • Process the user's name by making the output depend on it.
  • Use at least one regular expression when processing the user's name.
  • Use either an array or a hash somewhere in the program in some way that makes sense.
  • Define and call at least one function that takes at least one argument and uses that argument.
  • Output a web page with HTML tags.
  • Make your web page containing the form and your Perl script work on a server.
     
    Suggestions...
    You might find the example Perl script near the end of the Monday (Dec. 3) lecture slides to be helpful in terms of the HTML form, retrieving CGI parameters, and matching substrings with regular expressions.

    Individual Work:  This assignment should be performed individually (not in groups).