in reply to Help - I'm a C programmer
I may have the "sense" of the test backwards; depending on what else you're doing, unless might make more sense. Also, OUTER is not really a descriptive label outside of this example. Pick something that makes the last read better.OUTER: while (1) { while (($k, $v) = each %GRAMMAR) { last OUTER if Find_First($k, $v); } }
In general, I've found that using a variable to control a loop is a habit from other programming languages. Given Perl's powerful loop constructs, if you find yourself using a loop control variable, you may want to see if there's a way to avoid it. That's not an absolute; sometimes it's clearer to just say "while ($keepgoing)" or something, but often a last or next to a well-chosen label can be better. There's an excellent example in the perlsyn document regarding nested loops just like this.
HTH
|
|---|