Exploiting the Information World
ITEC-2110 - Fall 2000

These exercises are part of your grade!

For each exercise that you complete during class you must make record your results to show the TA (or show the TA your screen). If you don't have time to complete everything during class you must record your results and give them to the TA by the next class meeting.

EIW Exercises: Perl Regular Expressions


1.Perl HTML Filter

Write a perl program that reads in an HTML file, does the following substitutions and prints out the result:

For every <EIW> tag in the file it substitutes a
<SPAN style="font-family:sans-serif; font-size: 18pt; color: purple">
and for every </EIW> tag is substitutes a </SPAN> tag.

Once you get the above part working, add this code to your CGI program from last class that sent back a named file (the query string named a file that your CGI sent back), so that what reaches the browser will have the substitutions (no EIW tags).

2.Perl CGI Program that extracts field names

Write A perl-based CGI program that accepts a query string and extracts the field names and values from the query string (assume the query string comes from a form). The CGI program should send back an HTML table that lists the name and value of each field found.

Remember that the query string built by a browser (when dealing with an HTML form) will have the following structure:

name1=value1&name2=value&*name3=value3...

Your CGI program should also replace all '+' characters (in field names or values) with a ' ' (space character).