http://www.perlmonks.org?node_id=1203052


in reply to Translation Substring Error

The reason for the "substr outside of string" warning is that you assign the $seqarray variable to the empty string and you never assign it any other value. You are likely getting confused because you use the same name for two variables (an array and a scalar): $seqarray is a different variable from @seqarray. If you can specify what you want for output, you will get more specific help.

See also:

Replies are listed 'Best First'.
Re^2: Translation Substring Error
by FIJI42 (Acolyte) on Nov 09, 2017 at 16:06 UTC

    Basically, I was just trying to get a string for the translated amino acids:

    Example: MLVG

    If I have sequence like this: ATGGCGA, then I'd just like the translation: MA. The "A" from the end of "ATGGCGA" can be ignored/not output.

      This is what I'm getting with your program modified as in my earlier post below:
      $ perl dna.pl Sequence 1 Translation:MPV Sequence 2 Translation:ASQR