Actually I'd argue strongly in the other direction! The OP has two separate loops for handling different parts of a parsing process. At most a comment at the start of each is all that is required to make that clear. About the only change I'd make is to change the if statement into a statement modifier:
last if /^2/;
to make the last easy to see.
Aside from making the code harder to maintain because you are conflating two different processing phases into one statement, using a needless else increases code nesting and makes it harder to follow code flow. I find early exits (such is indicated above) make the normal flow of code much easier to see.
True laziness is hard work
|