Hello everyone! I just started using perl in school and we have to create an alignement table for sequences. I made the whole structure and I understand what I have to do, put i don't exacty know how to print it
#!/usr/bin/perl + + use strict; use warnings; my $S=" MSATPLTQEQKKA"; my $T=" MNATLTQQTKA"; my $n=length($S); my $m=length($T); my @seq1=split("",$S); my @seq2=split("",$T); print"\n\t "; print"@seq1\n"; print"\t "; for (my$j=0;$j<$n;$j=$j+1){ print" $j"; } print"\n\t 0"; print"\n\t"; $initialvalue=0; if($seq1[$i]==$seq2[$j]){ $match=0 if (($seq1[$i-1],$seq2[$j])>($seq1[$i],$seq2[$j-1])||($seq1[$i-1],$se +q2[$j-1]) $add=1 print"$initialvalue+$match+$add\n" } else($seq1[$i]!=$seq2[$j]{ $initialvalue= $initialvalue+1 if (($seq1[$i-1],$seq2[$j])>($seq1[$i],$seq2[$j-1])||($seq1[$i-1],$ +seq2[$j-1]) $add=1 print"$match+$add+$initialvalue\n" } print"\n"; for (my$k=0;$k<$m;$k=$k+1){ print"$seq2[$k] $k\n"; }
The thing is that each element must be an addition to the minimum between the upper element, the diagonal one and the one on the left, Thank you and I'm sorry for my bad English!!

In reply to Perl Array by baconyluv5

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.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, 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, summary, 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.