David Storrs writes: > Given that Perl 6 won't support an actual do-while loop a la C++ (and > yes, I know that Perl5 didn't either), how would you accomplish that? > That is, I'd like to have a loop that runs once, then checks its > condition to see if it should repeat and continues to repeat as long > as the condition is true. > > I don't think this works, but here's what I'm look for: > > { > $foo = readline; > ...do stuff with $foo... > } while ( $foo );
There's been some discussion about bringing a syntax back for that recently, but I haven't really been paying attention. Anyway, this is pretty clear: loop { $foo = readline; do { stuff :with($foo) }; last unless $foo; } Luke