Perl: How do I break from a do - while loop

ambuli
ambuli used Ask the Experts™
on

Hi Experts,

Is there a "break" in perl?

do
{
    if( some)
    {
        // break here
    }

} while( some condition );
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Use last
Try like this;
do
{
    if( some)
    {
        // break here
        last;
    }

} while( some condition );

Open in new window

if your not using strict subs you can also user the break stmt
also if you want to go to a specific line user the GOTO stmt

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial