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]