@nucleotides=('A','T','G','C'); foreach(1..1000) { $seq1.=$nucleotides[int(rand(3))]; } foreach(1..1000) { $seq2.=$nucleotides[int(rand(3))]; }

You are only using the first three elements of the array @nucleotides.    The proper way to do that is:

my @nucleotides = qw( A T G C ); foreach ( 1 .. 1_000 ) { $seq1 .= $nucleotides[ rand @nucleotides ]; $seq2 .= $nucleotides[ rand @nucleotides ]; }


@seq1=split('',$seq1); foreach(1..$window_size) { shift@seq1; } @seq2=split('',$seq2); foreach(1..$window_size) { shift@seq2; }

The usual way to do that is:

my @seq1 = split //, $seq1; splice @seq1, 0, $window_size; my @seq2 = split //, $seq2; splice @seq2, 0, $window_size;


open(OUT,">ID_matrix.txt");

You should always verify that open worked correctly:

open OUT, '>', 'ID_matrix.txt' or die "Cannot open 'ID_matrix.txt' bec +ause: $!";

In reply to Re: Speed up DNA dotplot by jwkrahn
in thread Speed up DNA dotplot by Microcebus

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.