Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: What is wrong in this code???

by Lotus1 (Curate)
on Dec 07, 2012 at 22:01 UTC ( #1007830=note: print w/replies, xml ) Need Help??


in reply to What is wrong in this code???

tr/// can be used to count characters in a string. No need to loop through.

use warnings; use strict; print "LATCG-\n"; while(<DATA>) { print $. . tr/A// . tr/T// . tr/C// . tr/G// . tr/-// . "\n"; } __DATA__ ATGAAAAAGAC AGCTATCGCGA TTGCAGTGGCA CTGGCTGGTTT CGCTACCGTAG CGC-A---TAG

Output:

LATCG- 171120 232330 323240 405240 522430 621224

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1007830]
help
Chatterbox?
[erix]: it could be interesting to know whether that 57M customer data breach at ueber was before or after the database switch
[erix]: or perhaps it is unrelated

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (9)
As of 2017-11-22 14:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In order to be able to say "I know Perl", you must have:













    Results (324 votes). Check out past polls.

    Notices?