CSIS054: Perl ProgrammingHomework set 3
|
1. Save the file dna.txt. Write a script that will count the number of occurences of each of the letters 'A', 'G', 'T', and 'C'. Report how many times each letter occurs in the file. |
2. Your boss at the genetics lab is preparing to order a half-million dollars worth of chemicals based on your analysis of the file above. Convince her, beyond a shadow of a doubt, that your numbers are correct. |
3. Save the file words.txt. Write a script that prints each word that occured in the file, one per line, in alphabetical order. If a word occurs in words.txt more than once, only report it once. (A word is a sequence of 1 or more alphabetical characters and the hyphen character. Words are separated by white-space and/or punctuation. Do not include punctuation, except for hyphenated words, in your report.) |
4. The Fibonacci sequence is a series of numbers where the next number is the sum of the previous two. For example, the first 10 numbers are: 1, 1, 2, 3, 5, 8, 13, 21, 34, 55 ... Write a script that prints out the first 100 Fibonacci numbers. |
5. Modify the script from #4 so that after each number, in parentheses, it prints the ratio of that number and the number before it. For example the 6th line of your output would be: (Because 8/5 = 1.6000) |
6. Modify accounts.pl so that it reads ID numbers and descriptions from a text file. (Instead of from arrays within the script, as it currently does.) |
7. Modify your work from #6 so that the data file stores an amount for "Quantity in Stock". Every time the program is run, and a certain item gets sold, have it:
|
Address of this page is http://hhh.gavilan.edu/phowell/csis054/03problems.html
Please contact Peter Howell at phowell@gavilan.edu for questions or comments.
Last updated January 16, 2010.