summaryrefslogtreecommitdiff
path: root/pp_ctl.c
diff options
context:
space:
mode:
Diffstat (limited to 'pp_ctl.c')
-rw-r--r--pp_ctl.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/pp_ctl.c b/pp_ctl.c
index a9bc3e5e09..1107ad9461 100644
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -1810,11 +1810,22 @@ PP(pp_enteriter)
(void) SvPV(right,n_a);
}
}
+ else if (PL_op->op_private & OPpITER_REVERSED) {
+ cx->blk_loop.itermax = 0;
+ cx->blk_loop.iterix = AvFILL(cx->blk_loop.iterary);
+
+ }
}
else {
cx->blk_loop.iterary = PL_curstack;
AvFILLp(PL_curstack) = SP - PL_stack_base;
- cx->blk_loop.iterix = MARK - 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;
+ }
+ else {
+ cx->blk_loop.iterix = MARK - PL_stack_base;
+ }
}
RETURN;