in reply to explanation of code pls

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 :-)