We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 31705cd commit cd97dc8Copy full SHA for cd97dc8
pp_ctl.c
@@ -2546,7 +2546,10 @@ PP(pp_next)
2546
{
2547
PERL_CONTEXT *cx;
2548
2549
- cx = S_unwind_loop(aTHX);
+ /* if not a bare 'next' in the main scope, search for it */
2550
+ cx = CX_CUR();
2551
+ if (!((PL_op->op_flags & OPf_SPECIAL) && CxTYPE_is_LOOP(cx)))
2552
+ cx = S_unwind_loop(aTHX);
2553
2554
TOPBLOCK(cx);
2555
PL_curcop = cx->blk_oldcop;
t/perf/benchmarks
@@ -1030,6 +1030,12 @@
1030
code => 'for (@a) {}',
1031
},
1032
1033
+ 'loop::for::next4' => {
1034
+ desc => 'for loop containing only next with my var and integer 4 array',
1035
+ setup => 'my @a = (1..4);',
1036
+ code => 'for my $x (@a) {next}',
1037
+ },
1038
+
1039
'loop::while::i1' => {
1040
desc => 'empty while loop 1 iteration',
1041
setup => 'my $i = 0;',
0 commit comments