From 39eb404022bff33467711717d8de9566914a79f1 Mon Sep 17 00:00:00 2001 From: Gurusamy Sarathy Date: Tue, 28 Dec 1999 19:55:56 +0000 Subject: range operator does magical string increment iff both operands are non-numbers, from Tom Phoenix ; fixed the "foreach (RANGE)" case as well p4raw-id: //depot/perl@4730 --- pp_ctl.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'pp_ctl.c') diff --git a/pp_ctl.c b/pp_ctl.c index c028b4eca5..34e18b5f32 100644 --- a/pp_ctl.c +++ b/pp_ctl.c @@ -997,7 +997,9 @@ PP(pp_flop) mg_get(right); if (SvNIOKp(left) || !SvPOKp(left) || - (looks_like_number(left) && *SvPVX(left) != '0') ) + SvNIOKp(right) || !SvPOKp(right) || + (looks_like_number(left) && *SvPVX(left) != '0' && + looks_like_number(right) && *SvPVX(right) != '0')) { if (SvNV(left) < IV_MIN || SvNV(right) > IV_MAX) DIE(aTHX_ "Range iterator outside integer range"); @@ -1674,7 +1676,11 @@ PP(pp_enteriter) if (SvTYPE(cx->blk_loop.iterary) != SVt_PVAV) { dPOPss; if (SvNIOKp(sv) || !SvPOKp(sv) || - (looks_like_number(sv) && *SvPVX(sv) != '0')) { + SvNIOKp(cx->blk_loop.iterary) || !SvPOKp(cx->blk_loop.iterary) || + (looks_like_number(sv) && *SvPVX(sv) != '0' && + looks_like_number((SV*)cx->blk_loop.iterary) && + *SvPVX(cx->blk_loop.iterary) != '0')) + { if (SvNV(sv) < IV_MIN || SvNV((SV*)cx->blk_loop.iterary) >= IV_MAX) DIE(aTHX_ "Range iterator outside integer range"); -- cgit v1.2.1