in reply to foreach to for (related to my last question)

I assume you mean to say that the first version of the code works and the second doesn't, but you haven't said how it fails to work. Or, for that matter, what you are trying to accomplish by changing it. (I have a vague feeling this could be an [id://XY problem].)

My best guess is that you're seeing the for loop in the second version terminate at the wrong time (either dying early or running past the end of %SEQ depending on the size of @codons) because you keep changing the value of $s. But that's just a guess as to how it's failing. If I'm wrong about the failure mode, then I'm most likely wrong about the cause as well.

  • Comment on Re: foreach to for (related to my last question)