Hello allsop_5, and welcome to the Monastery!

The code as given is imcomplete, as it doesn’t show the declaration and initialization of the variables $string and $shuf_seq. It would be useful if you could provide sample values for these variables, together with the final $score value you expect to generate from these sample values.

One point stands out: in these lines:

$score = scoring($s, $m); $score += $score;

you first overwrite the value of the variable $score, then add this new value to itself (thereby doubling it). Neither of these is what you intend. You need something along these lines:

my $score; foreach (...) { ... my $local_score = scoring($s, $m); $score += $local_score; print $local_score; # (or did you want to print $score here?) }

And BTW: you do begin your script with:

use strict; use warnings;

don’t you?

Hope that helps,

Athanasius <°(((><contra mundum Iustus alius egestas vitae, eros Piratica,


In reply to Re: Bioinformatics - Scoring DNA mutations by Athanasius
in thread Bioinformatics - Scoring DNA mutations by allsop_5

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.