Dear Monks,

I am having trouble understanding a part of program that I am trying to tweak that I got off the web for sequence alignment.

I haven't changed anything but keep getting errors for

while (scalar(@ra) while (scalar(@rb) while (scalar(@rc) # print out the answer

It is in the context of

if (!$d->[$x][$y][0] && !$d->[$x][$y][1] && !$d->[$x][$y][2]) { for (my $u=$x; $u>0; $u--) { unshift @ra, $sa[$u-1]; } for (my $v=$y; $v>0; $v--) { unshift @rb, $sb[$v-1]; } while (scalar(@ra) while (scalar(@rb) while (scalar(@rc) # print out the ans +wer $i++; # global variable $scr = 0; # score for each alignment print "<br>Alignment: $i<br>Sa:"; foreach my $x (@ra) { print " $x"; } + print "<br>Sb:"; foreach my $y (@rb) { print " $y"; } + print "<br>Scr"; foreach my $z (@rc) { if ($z eq '.') { print " ."; } else { printf '%4d', $z; $scr += $z; } } print " = $scr<br>"; }

What does it mean? And why do I keep getting errors? #I know that scalar() is to force scalar context.#

Thanks Monks, chris


In reply to while (scalar() by Anonymous Monk

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.