为什么我的继续执行Perl 5.10中的下一个块?

Joe*_*Fan 2 perl continue switch-statement

当我运行这个:

use feature ':5.10';
$x=1;
given ($x) {
    when(1) {
        say '1';
        $x = 2;
        continue;
    }
    when (2) {
        say '2';
    }
}
Run Code Online (Sandbox Code Playgroud)

这应该打印1和2,但它只打印1.我错过了什么?

编辑:

我添加了$ x = 2,它仍然只打印"1"

mik*_*grb 9

请参阅perlsyn手册页:

给定(EXPR)将在块的词法范围内将EXPR的值赋给$ _

此代码输出1和2:

use feature ':5.10';
$x=1;
given ($x) {
    when(1) {
        say '1';
        $_ = 2;
        continue;
    }
    when (2) {
        say '2';
    }
}
Run Code Online (Sandbox Code Playgroud)