Since you didn't say exactly what parts you are having trouble with, I'm going to assume you need help on everything. To wit: read perlvar for an explanation of the $' variable, perldoc -f length for explanation of the length() builtin function, perlre + perlretut for explanations of regular expressions.

Assuming it's just the RE that's giving you trouble, it tries to match "ATG" followed by zero or more sequences of three characters (non greedily) followed by any one of "TAA", "TAG" or "TGA" but does not consume those 3 alternates. (?=...) is a zero-width positive lookahead assertion. It's a way to match without consuming input. So that RE will match strings like "ATGTAG" or "ATGXXXTAA" without consuming the TAA portion so that it can match again if the string were really "ATGXXXTAATGTAG" (but presumably this is DNA so there are no "X" characters :-)


In reply to Re: explanation of code pls by duff
in thread explanation of code pls by imlou

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.