Introduction to Bioinformatics

Creating a Reusable Perl Module


Prep readings:

In this assignment, we wish to:


Getting Started with Modules

  1. First, read pages 102-103 of Chapter 6 on "Modules and Libraries of Subroutines."
  2. Next, download the first two files described above:
  3. Look carefully at the contents of both of these files. Make sure you understand the difference between them.
  4. Now, test that the driver program works correctly by running it.
  5. Note that these files show you the type of code packaging required in future code you submit for this class. For any remaining labs and for Perl code associated with your term project, you will post both your driver program and your Perl module(s) containing your carefully documented and tested subroutines.
  6. In addition, future subroutines described in your text will be available in the package posted with the other example code from your text. Open the BeginPerlBioinfo.pm file right now, and familiarize yourself with its contents.

Getting More Practice with Parameter Passing

  1. Next, read pages 98-102 of Chapter 6 on "Passing Data to Subroutines."
  2. Print out the MyPerlSubs.pm subroutine module provided above and note in the code where any subroutines are using pass by reference. Compare the syntax in the provided code to the syntax in your book until it makes sense to you how code performing pass by reference is written and how it works.
  3. How does the call to subroutines in vowels7.pl that use pass by reference parameters compare to calls involving parameters to subroutines which use pass by value?

Getting Credit for Your Progress

Using the files provided above as a guide (vowels7.pl and MyPerlSubs.pm), take your latest DNA processing code currently stored in nucleotide-counting4.pl and reorganize it into these two files:

Next, follow these steps:
  1. Test your new driver program thoroughly to make sure it still works when the code is separated into two files.
  2. Consider at least one subroutine that might be a good candidate for using pass by reference.
  3. Make any necessary changes to the subroutine in the module file and to the call in the driver program to include pass by reference.
  4. Test and debug your code until everything is still working correctly.
  5. Include a link to your new files on your course Webpage, near the heading, "Lab: Creating a Reusable Perl Module."

Feel free to check out how the other students in the class are doing on the assignments.
These pages are optimized for viewing under Netscape.
© Copyright 2003. Melanie A. Sutton, Ph.D. (msutton@uwf.edu) All rights reserved.