Difference between revisions of "Exercise 4.4"

From Earlham CS Department
Jump to navigation Jump to search
(New page: Return to Week 1 <b>Exercise 4.4 in <i>Beginning Perl for Bioinformatics</i></b> <br><br> <nowiki>#!/usr/bin/perl -w use strict;</nowiki> <nowiki>#Erika Phelps #Sept. 21, 2009 #Exerc...)
 
 
Line 3: Line 3:
 
<b>Exercise 4.4 in <i>Beginning Perl for Bioinformatics</i></b>
 
<b>Exercise 4.4 in <i>Beginning Perl for Bioinformatics</i></b>
 
<br><br>
 
<br><br>
<nowiki>#!/usr/bin/perl -w
+
<pre>#!/usr/bin/perl -w
use strict;</nowiki>
+
use strict;
  
<nowiki>#Erika Phelps
+
#Erika Phelps
 
#Sept. 21, 2009
 
#Sept. 21, 2009
#Exercise 4.4</nowiki>
+
#Exercise 4.4
  
 
#Do the same thing  as Exercise 4.3, but use the string directives \u and \L  
 
#Do the same thing  as Exercise 4.3, but use the string directives \u and \L  
Line 41: Line 41:
  
 
exit;
 
exit;
 +
</pre>

Latest revision as of 13:01, 23 September 2009

Return to Week 1

Exercise 4.4 in Beginning Perl for Bioinformatics

#!/usr/bin/perl -w
use strict;

#Erika Phelps
#Sept. 21, 2009
#Exercise 4.4

#Do the same thing  as Exercise 4.3, but use the string directives \u and \L 
#for upper and lower case.

#The DNA (input both in upper and lower case)

my $DNA1 = 'ATGCCGGTAGAATATACCCGA';
my $DNA2 = 'cccggctaatatacgctag';

#Print the DNA to the screen

print "Here are the DNA sequences that have been provided:\n\n";

print "DNA1:$DNA1.\n\n";

print "DNA2: $DNA2.\n\n";

#Concatenating the DNA

my $DNA3 = "$DNA1$DNA2";

#Print the concatenated DNA all in lowercase 

print "The concatenated DNA is (lowercase):\L$DNA3.\n\n";

#Print the concatenated DNA all in uppercase

print "The concatenated DNA is (uppercase):\U$DNA3.\n";

#End of program

exit;