}
}
else if (PL_op->op_private & OPpITER_REVERSED) {
- cx->blk_loop.itermax = -1;
- cx->blk_loop.iterix = AvFILL(cx->blk_loop.iterary);
+ cx->blk_loop.itermax = 0;
+ cx->blk_loop.iterix = AvFILL(cx->blk_loop.iterary) + 1;
}
}
cx->blk_loop.iterary = PL_curstack;
AvFILLp(PL_curstack) = SP - PL_stack_base;
if (PL_op->op_private & OPpITER_REVERSED) {
- cx->blk_loop.itermax = MARK - PL_stack_base;
- cx->blk_loop.iterix = cx->blk_oldsp;
+ cx->blk_loop.itermax = MARK - PL_stack_base + 1;
+ cx->blk_loop.iterix = cx->blk_oldsp + 1;
}
else {
cx->blk_loop.iterix = MARK - PL_stack_base;
RETPUSHNO;
if (SvMAGICAL(av) || AvREIFY(av)) {
- SV ** const svp = av_fetch(av, cx->blk_loop.iterix--, FALSE);
+ SV ** const svp = av_fetch(av, --cx->blk_loop.iterix, FALSE);
sv = svp ? *svp : Nullsv;
}
else {
- sv = AvARRAY(av)[cx->blk_loop.iterix--];
+ sv = AvARRAY(av)[--cx->blk_loop.iterix];
}
}
else {
#
# -- .robin. <robin@kitsite.com> 2001-03-13
-print "1..46\n";
+print "1..47\n";
my $ok;
}
}
+
+{
+ # [perl #37725]
+
+ $a37725[3] = 1; # use package var
+ $i = 2;
+ for my $x (reverse @a37725) {
+ $x = $i++;
+ }
+ print "@a37725" == "5 4 3 2" ? "" : "not ",
+ "ok 47 - reverse with empty slots (@a37725)\n";
+}
+