continue BLOCK
continue

當後面接著 BLOCK 時,continue 實際上是流程控制語法,而非函式。如果 BLOCK 附加了 continue BLOCK(通常在 whileforeach 中),它總是在條件即將再次評估之前執行,就像 C 中 for 迴圈的第三部分。因此,它可用於遞增迴圈變數,即使迴圈已透過 next 語法繼續執行(類似於 C 中的 continue 語法)。

lastnextredo 可以在 continue 區塊中出現;lastredo 的行為就像在主區塊中執行一樣。 next 也是如此,但由於它會執行 continue 區塊,因此可能會更有趣。

while (EXPR) {
    ### redo always comes here
    do_something;
} continue {
    ### next always comes here
    do_something_else;
    # then back the top to re-check EXPR
}
### last always comes here

省略 continue 區段等同於使用一個空區段,因此 next 會直接回到迴圈開頭檢查條件。

當沒有 BLOCK 時,continue 是函式,它會穿透目前的 whendefault 區塊,而不是迭代動態封裝的 foreach 或結束詞彙封裝的 given。在 Perl 5.14 及更早版本中,這種形式的 continue 僅在啟用 "switch" 功能 時可用。請參閱 feature"Switch Statements" in perlsyn 以取得更多資訊。