Problems? Is your data what you think it is? | |
PerlMonks |
Re: while loop questionby Ovid (Cardinal) |
on Sep 06, 2012 at 13:58 UTC ( [id://992095]=note: print w/replies, xml ) | Need Help?? |
Yes, but it has to be handled manually and you'll have to consider the best way of handling that. One way of handling this is retesting the condition in a continue block: while (EXPR) BLOCK continue BLOCKNote variables defined in the EXPR of the while loop are visible in the scope of the continue block. That's what makes this work even if you can't necessarily do this after the while loop because the condition you want to test may no longer be valid and you can't tell if a last was used or not.
And that prints out:
Again, the variants of this technique change from time to time, depending on what you need. Be careful, though. Using last in the while loop will skip the continue statement, but that appears to be what you want in this case.
In Section
Seekers of Perl Wisdom
|
|