Jenda, You CANNOT do what you are suggesting.
$ perldoc -f do do BLOCK Not really a function. Returns the value of the last command in the sequence of commands indicated by BLOCK. When modified by a loop modifier, executes the BLOCK once before testing the loop condition. (On other statements the loop modifiers test the conditional first.) "do BLOCK" does not count as a loop, so the loop control statements "next", "last", or "redo" cannot be used to leave or restart the block. See the perlsyn manpage for alternative strategies. My script failed because I was using 'last' inside a do-while construct. This is why I posted this. It is a statement NOT a loop structure. Jeff --- Jenda Krynicky <[EMAIL PROTECTED]> wrote: > From: Jeff Westman <[EMAIL PROTECTED]> > > > In other languages, such as C, there is little difference between a > > while() loop and a do-while() loop. The only difference of course > > being that that do-while() loop will always execute at least once > > (test after), while the while-loop does a test before.... > > > > Much to my amazement, do() in perl is a STATEMENT BLOCK and not a > > loop! Yet the while() construct is a loop. > > do{} by itself is not a loop, but with while() it can be: > > do {print '.';print ':';} while ($x++ < 10); > .:.:.:.:.:.:.:.:.:.:.: > do {print '.';print ':';} while ($x++ < -10); > .: > do {print '.';print ':';last} while ($x++ < 10); > .: > do {print '.';last;print ':';} while ($x++ < 10); > . > > So I guess the do{} in Perl is just an extension to the "do-while()" > in other languages. It started as the first part of the do-while() > construct and then started a life of its own :-) > > Jenda > ===== [EMAIL PROTECTED] === http://Jenda.Krynicky.cz ===== > When it comes to wine, women and song, wizards are allowed > to get drunk and croon as much as they like. > -- Terry Pratchett in Sourcery > > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > __________________________________________________ Do you Yahoo!? Yahoo! Tax Center - forms, calculators, tips, more http://taxes.yahoo.com/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]