in reply to Re: Test break, but still doing
in thread Test break, but still doing

Personally, if I ever find myself wanting to label a loop block, I seriously look into refactoring.

last, next, and redo, have a lot more in common with the hated goto then they do with structured programming.

In some ways they are worse than goto because it takes more effort to find where they are transfering control to (you have to work your way out from nested blocks checking whether each is a loop or not and the editors I use can easily jump to "MyLabel:" but don't have a shortcut for even "jump to top of enclosing loop" (and then to the bottom in case the top is "do {" and we can't tell from that whether we are in a loop or not), much less "jump to top (or bottom) of enclosing Perl loop".

I don't feel too guilty using last, next, and redo sparingly for fairly small loops (I've even experimented with out-denting such lines, but I'm not sure the effect works). I prefer to refactor into a subroutine so I can use return (or, for a complex loop I'll refactor parts into subroutines so that I'm left with a small loop that uses last, next, or redo).

        - tye (but my friends call me "Tye")