do..whileはループじゃない

だからnext, last, redoは使えません。
(ループじゃないってのは言い過ぎ)

do BLOCK does not count as a loop, so the loop control statements next, last, or redo cannot be used to leave or restart the block. See perlsyn for alternative strategies.
do - perldoc.perl.org

perlsynからも引用しちゃう。

Note also that the loop control statements described later will NOT work in this construct, because modifiers don't take loop labels. Sorry. You can always put another block inside of it (for next) or around it (for last) to do that sort of thing. For next, just double the braces:

do {{
    next if $x == $y;
    # do something here
}} until $x++ > $z;

For last, you have to be more elaborate:

LOOP: { 
    do {
        last if $x = $y**2;
        # do something here
    } while $x++ <= $z;
}

ようは、このdoってのは

my $hoge = do { # do something };

のことで、単にブロック内を実行して最後に評価した値を返すだけで、つまりその中でnextとかlastとかするのはこういうことになるのかなと思った。

next while $x++ <= $z;

だからnextとかlastの対象になるものがなくてっていう。

    • -

Perl Best PracticeのP123、Don't use do...while loops.
まあ、do..whileってぜんぜん使う機会ないからいいんだけど。