bsb has asked for the wisdom of the Perl Monks concerning the following question:

You can to stick a continue on a bare block, but is it ever a good idea?

It seems like it might be useful for some types of clean up code, without the closure implementation of Error. On the other hand, as a flow control construct it seems even messier than goto.

Are there any sane uses out there?

BLOCK: { # last; redo; next; } continue { # last; redo; or even potentially next; }

Replies are listed 'Best First'.
Re: "continue" with no while considered harmful?
by Abigail-II (Bishop) on Aug 04, 2003 at 10:51 UTC
    I expect it's there mostly because of consistency. Other than in JAPHs, I've never used a continue on a bare block - but then, I can't remember the last time I used a continue on a while or foreach block.

    But I do like bare blocks. Sometimes I find it more convenient to write {...; redo; ...} than while (1) {...; last; ...}. It'll depend on the use of last/next/redo.

    Abigail