While running this the first two $orf with $count values ge 4 do not enter the "for" loop (it does print the newline contained in "if" statement). However all subsequent values of $count ge 4 do.
$input = 'YAVSNCKFNIEDYNNIFKVMENIRKHSNKNLNDQDELNIYLGVQSSNAKR'; $l = length ($input) - 1; ### P(a), P(b), P(turn), f(i), f(i+1), f(i+2), f(i+3) ### %aa = ( A => [1.42,.83,.66,0.060,0.076,0.035,0.058], R => [.98,.93,.95,0.070,0.106,0.099,0.085], N => [.67,.89,1.56,0.161,0.083,0.191,0.091], D => [1.01,.54,1.46,0.147,0.110,0.179,0.081], C => [.70,1.19,1.19,0.149,0.050,0.117,0.128], E => [1.51,.37,.74,0.056,0.060,0.077,0.064], Q => [1.11,1.10,.98,0.074,0.098,0.037,0.098], G => [.57,.75,1.56,0.102,0.085,0.190,0.152], H => [1.00,.87,.95,0.140,0.047,0.093,0.054], I => [1.08,1.60,.47,0.043,0.034,0.013,0.056], L => [1.21,1.30,.59,0.061,0.025,0.036,0.070], K => [1.14,.74,1.01,0.055,0.115,0.072,0.095], M => [1.45,1.05,.60,0.068,0.082,0.014,0.055], F => [1.13,1.38,.60,0.059,0.041,0.065,0.065], P => [.57,.55,1.52,0.102,0.301,0.034,0.068], S => [.77,.75,1.43,0.120,0.139,0.125,0.106], T => [.83,1.19,.96,0.086,0.108,0.065,0.079], W => [1.08,1.37,.96,0.077,0.013,0.064,0.167], Y => [.69,1.47,1.14,0.082,0.065,0.114,0.125], V => [1.06,1.70,.50,0.062,0.048,0.028,0.053],); for(my $i=0; $i < $l - 4; $i++) { my $col = 0; # reference to hashmap column 1, P(a) $orf = substr($input,$i,6); @fra = split('', $orf), "\t"; $count = count(@fra), "\t"; #characters ge 1 print $orf, " ", $count, "\n"; if ($count ge 4) { for (my $j=$i+3; $j le $l - 3; $j++) { print my $frame = substr($input, $j, 4);# print " "; print my $alpha4 = average ($frame, $col), "\n"; if ($alpha4 lt 1.00) {$j = $l}; }; print "\n"; } } exit; sub count { my $c = 0; foreach (@_) { my $p = $aa{$_}[0]; if ($p ge 1.00) {$c++}; } return $c; } sub average { my ($frame, $col) = @_; my $a = 0; @seq = split ('', $frame); foreach $_ (@seq) { $a += $aa{$_}[$col]; } return $a/(length($frame)); }

In reply to Beginner issues! 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.