CMPS 401 - Programming Languages

Spring 2007

Assignment #3

Due: March 29, 2007


In this assignment you will use Perl on a Linux server to work with regular expressions. The task is to write a Perl program that will be called over the web (via browser) and will do the following:


  • You will need to open the file mysourcefile which will be located on the server, read it in an array and then print it on the browser.
  • Then you will need to do a scan of the contents of the array in which you hold the contents of the file and for each line you will need to do the following:
    • Translate all occurrences of the string %*% to the character # (note that * here is the character itself)
    • Change all digits appearing in the line to the next digit (e.g. translate 5 to 6, 8 to 9, etc)
    • Make sure that all words in the file are appropriately translated to start with a capital case character
  • Turn in a report with your code, with comments and an explanation of how it works. You will have to demonstrate your solution on line.

The objectives of this assignment are:

  • To familiarize you with Perl with the added benefit of working with a web programming language and server programming
  • To familiarize you with file operations
  • To familiarize you with regular expressions