Perl Exercise #2

Read a DNA sequence from a text file
Calculate the %GC content

If you add the line Use strict to your program, it will require you to initialize all variables with "My" names. That is too much hassle for this exercise, so we will not bother with that unless you want to.

Write the output to the screen and to a file use append so that the file will grow as you run this program on additional sequences

HINTS:

What about non-DNA characters in the file?
- carriage returns and blank spaces
- N's or X's or unexpected letters

Your program would be much more useful if it asked for a filename of the DNA sequence to be entered from the keyboard, rather than requiring you to edit the Perl code each time you want to run it on a new sequence.

If you try to read a file from a name that is typed in at the keyboard, what if there is no such file?

Send me your program and the results from running it on these 3 sequence files:
dna1.seq
dna2.seq
dna3.seq

Stuart Brown - RCR
Last modified: Mon Feb 25 15:46:09 EST 2008