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
In reply to Re: What is wrong in this code???
by Lotus1
in thread What is wrong in this code???
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |