in reply to Index isn't progressing in C-style for loop

If the basic problem is that $lineIndex is not incrementing in the inner "for" loop, it must be because the "if" condition inside that loop is always coming up true on the first iteration of that loop, so you just skip to the next iteration of the outer "for" loop (over @gbList items).

Have you tried stepping through this with the debugger (and including Data::Dumper or related module for inspecting data structures)? I'd put a break point at the "if" statement.

When execution stops there, check the contents of the relevant variables and array elements to see whether they have unexpected values, or whether your choice of syntax is yielding unexpected results.

  • Comment on Re: Index isn't progressing in C-style for loop