in reply to Perl Best Practices - Loop Labels
Hi Ken,
Your usage of loop labels seems completely correct to me. I use them for exactly the same control, usually to jump out early of an inner or maybe the outer loop. It's a standard technique to keep track of where you are and move around.
Having said that, I try to avoid deeply nested loops -- i.e. no more than two levels, and as swl said, if you find yourself needing more than one level of nesting, it's likely time to refactor and make some subroutines.
I also agree that people who don't understand Perl's loop control labels and use of goto to dispatch to another method, are often laboring under a misconception or two when they give their opinion on the matter.
Hope this helps!
|
|---|