in reply to "last" not really outside loop block
do { ... } while 1;
is no different than
print ... while 1;
The while is a statement modifier. There's no loop block, and one is needed for redo, next and last to work.
A generic solution is to add a loop. Keep in mind that a bare block is a loop that executes once.
$a = 3; LOOP_ONCE: { do { last unless $a == 4; } while cond(); }
The label (LOOP_ONCE:) is descriptive and not necessary.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: "last" not really outside loop block
by spx2 (Deacon) on Jun 22, 2009 at 15:59 UTC | |
by ikegami (Patriarch) on Jun 22, 2009 at 16:15 UTC |