Re: How to break from a do while loop in perl?




"jeniffer" <zenith.of.perfection@xxxxxxxxx> wrote in message
news:1143510464.401145.166910@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
i read that last doesnt work inside a do while loop.Then how to break
out from a do-while loop...
do{
if(some condition)
{
last;
}

}while(condition)


Do what the docs say: wrap it in a labeled block (see perlsyn, "Statement
Modifiers").

Depending on how simple your loop is, you could also just set the while
condition to true in the if conditional and run your code in the else.

Matt


.



Relevant Pages

  • Re: Disk Geometry
    ... Depending on an individual's newsreader settings, long links can wrap ... causing the link to be ruined. ...
    (comp.unix.bsd.freebsd.misc)
  • Re: start of sentence & after fullstop with capital
    ... It will wrap to the next line depending ... on the font size and page format that you are using. ...
    (microsoft.public.word.newusers)
  • Re: Garmin 12 Map, bread crumb trail??
    ... Record Mode: Full or Wrap (depending on what you want). ... Dominic Sexton ...
    (sci.geo.satellite-nav)
  • Re: Text Wrapping
    ... Welcome to this Microsoft Project newsgroup :-) ... Depending on the version of Project you're using, ... However, the wrapping requires a space to wrap from, and thus without a work ... fields like Resource Names which do not have spaces between the ...
    (microsoft.public.project)