Perl III Problem Set ==================== 1. Create a script that divides two numbers provided on the command line. Your script should have the following requirements: Two numbers are required. The numbers have to be positive. The divisor cannot be zero. You should take care of the following in your Perl script ========================================================= Write the quotient to STDOUT Write any errors to STDERR You should take care of the following on the command line in UNIX ================================================================== Redirect STDOUT to an output file (out.txt) Redirect STDERR to an error file (err.txt) 2. Open a file using the open function. As you read in lines from the file, make all the letters in each line uppercase. (There's a built-in Perl function which will do this.) Open a new file for output using the open function. Write the output to this file 3. Open the provided fasta file (File 3). Print the reverse complement of each sequence. Make sure to print the output in fasta format including the sequence name and a note in the description that this is the reverse complement. Print to STDOUT and capture the output into a file with a command line redirect '>'. 4. Open the provided fastq file (File 2). Go through each line of the file. Count the number of lines and the number of characters per line. Have your program report the: a. total number of lines b. total number of characters c. average line length 5. Create a script that uses <> to read in the contents of the provided text file (File 1). Use the function index() to a. find the first position of 'Nobody' on every line b. find the first position of 'somebody' on every line Use the warn() function to warn the user that 'somebody is here' ** You can look up how to use the index() and warn() functions in your books, from the command line with the perldoc command, or on perldoc.org. |
Comments are closed.