Alternative to “last” in do loops

According to the perl manual for for last (http://perldoc.perl.org/functions/last.html), last can't be used to break out of do {} loops, but it doesn't mention an alternative. The script I'm maintaining has this structure:

do {
    ...
    if (...) 
    {
        ...
        last;
    }
} while (...);

and I'm pretty sure he wants to go to the end of the loop, but its actually exiting the current subroutine, so I need to either change the last or refactor the whole loop if there is a better way that someone can recommend.

8
задан DAG 6 December 2010 в 18:13
поделиться