Your skill will accomplishwhat the force of many cannot PerlMonks

### Comment on

 Need Help??

Hi PerlMonks,

I have a string like "ATCGGCGCCTAT" consisting of four 3-letter words (ATC,GGC,GCC,TAT). I am interested to count the number and the kinds of letters (A,T,G,C) at 1st, 2nd and 3rd positions of these four words. I am a beginner in perl programming. I shall be glad if any perl monk can help me by providing the syntax/perl code that can count letters and their kinds in 1st, 2nd and 3rd position of 3-letter words. Separate scalar variable may be used for each position and letter. For instance, for the 1st position the scalar variables may be \$A1, \$T1, \$G1 and \$C1. Similarly, for 2nd the scalar variables may be \$A2,\$T2,\$G2,\$C2 and for 3rd position \$A3,\$T3,\$G3 and \$C3.

```#!usr/bin/perl-w
\$a="ATCGGCGCCTAT";
code??
print" Letters at 1st position:\n
A1=\$A1; T1=\$T1; G1=\$G1; C1=\$C1; \n
Letters at 2nd position:\n
A2=\$A2; T2=\$T2; G2=\$G2; C2=\$C2; \n
Letters at 3rd position:\n
A3=\$A3; T3=\$T3; G3=\$G3; C3=\$C3; \n";
exit;

Expected results are:

```The result of counting from the string should look like:
Letters at 1st position:
A1=1; T1=1; G1=2; C1=0;
Letters at 2nd position:
A2=1; T2=1; G2=1; C2=1;
Letters at 3rd position:
A3=0; T3=1; G3=0; C3=3;

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

• Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
• Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
• Read Where should I post X? if you're not absolutely sure you're posting in the right place.
• Posts may use any of the Perl Monks Approved HTML tags:
a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
• You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
 For: Use: & & < < > > [ [ ] ]
• Link using PerlMonks shortcuts! What shortcuts can I use for linking?

Create A New User
Chatterbox?
 [james28909]: compiled and install perl 5.16.3 in WSL [james28909]: seems to work fine so far. have not tested any modules yet though

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (4)
As of 2018-05-22 22:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
Voting Booth?
World peace can best be achieved by:

Results (166 votes). Check out past polls.

Notices?