Difference between revisions of "Exercise 5.10D"
Jump to navigation
Jump to search
(New page: Return to Week 2 <br> Exercise 5.3 in <i>Beginning Perl for Bioinformatics</i></b> <pre> #!/usr/bin/perl -w use strict; #Damian Almiron #Ex5-10 #Pseudocode: #Write a program th...) |
|||
Line 1: | Line 1: | ||
Return to [[Week 2]] | Return to [[Week 2]] | ||
<br> | <br> | ||
− | Exercise 5. | + | Exercise 5.10 in <i>Beginning Perl for Bioinformatics</i></b> |
<pre> | <pre> |
Latest revision as of 11:47, 18 December 2009
Return to Week 2
Exercise 5.10 in Beginning Perl for Bioinformatics
#!/usr/bin/perl -w use strict; #Damian Almiron #Ex5-10 #Pseudocode: #Write a program that stores info into a temp file and then deletes it. #Use program from exercise4-5 to get info for a temp file. #print the temp file. #unlink the temp file. #From ex4-5 # Write a program to reverse transcribe RNA to DNA # The RNA variable my $RNA = 'AUGCAUGCAUGCAUGCAUU'; print "This is our original RNA:\n\n” print “$RNA.\n\n"; #Reverse transcription my $DNA = $RNA; $DNA =~ s/U/T/g; #Print the DNA to the screen print "Here is the resulting DNA:\n\n"; print "$DNA.\n\n"; } #Copy results to "tmpfile" – go over this code!!! my $outputfile = "tmpfile"; unless ( open(tmpfile, ">$outputfile") ) { print "Cannot open file \"$outputfile\" to write to.\n\n"; exit; } #Print what is in tmpfile print tmpfile "$count\n"; #Close the file. close (tmpfile); #Unlink/delete the file unlink "tmpfile"; #Make sure file has been deleted. unless ( open(tmpfile, ">$outputfile") ) { print "The file \"$outputfile\" does not exist.\n\n"; exit; } #The End exit;