<?xml version="1.0" encoding="windows-1252"?>
<node id="1007830" title="Re: What is wrong in this code???" created="2012-12-07 17:01:25" updated="2012-12-07 17:01:25">
<type id="11">
note</type>
<author id="922586">
Lotus1</author>
<data>
<field name="doctext">
&lt;p&gt;&lt;c&gt;tr///&lt;/c&gt; can be used to count characters in a string. No need to loop through.&lt;/p&gt;
&lt;c&gt;use warnings;
use strict;

print "LATCG-\n";

while(&lt;DATA&gt;) {
    print $. . tr/A// . tr/T// . tr/C// . tr/G// . tr/-// . "\n";
}

__DATA__
ATGAAAAAGAC
AGCTATCGCGA
TTGCAGTGGCA
CTGGCTGGTTT
CGCTACCGTAG
CGC-A---TAG
&lt;/c&gt;

&lt;p&gt;Output:&lt;/p&gt;
&lt;c&gt;
LATCG-
171120
232330
323240
405240
522430
621224
&lt;/c&gt;</field>
<field name="root_node">
1007821</field>
<field name="parent_node">
1007821</field>
</data>
</node>
