syntax - Why isn't Perl's tr/// doing what I want? -


I am using a pearl for a script which moves the input into two small strings of DNA. As an output, I add two string strings, then print the second line in the copy at the end of the concatenated string. For example: If the input string is AAAA and TTTTT then print:

  AAAAATTTTT TTTTT  

I know there are other ways to do this but I I'm curious to know that the use of my tr /// is not working.

The code for the program is:

  Use strict; Use warnings; Print "Enter a DNA sequence \ n"; $ DNA1 = & lt; & Gt ;; # & Lt; & Gt; Shortcodes for STDIN $ DNA1 = ~ S / \ r? \ N? $ //; Print $ DNA1 "\ n \ n"; Print "Enter second DNA sequence \ n"; $ DNA2 = & lt; & Gt ;; $ DNA2 = ~ s / \ r? \ N? $ //; Print $ DNA2 "\ n \ n"; $ DNA = addition ("", ($ DNA1, $ DNA2)); Print "has both DNA views \" $ DNA \ "\ n \ n"; $ DNA3 = $ DNA1; $ DNA3 = ~ tr / ATCGatcg //; $ DNA3 Print \ n \ n "; $ DNA4 = Join (" ", ($ DNA3, $ DNA2)); Print $ DNA4" \ n \ n "; Go Out;  

Your TR changes any ACTGatcg and removes them I think you want

  $ DNA3 = ~ tr / atcgatCG / /;  

Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -