From: Jeff Pinyan Date: Mon, 16 Jul 2001 18:46:53 +0000 (-0400) Subject: Re: [PATCH gv.c] allow ${"1f"} to be non-regex var X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=e521374caf664d14b86b1eb0931fa32b77c9367f;p=p5sagit%2Fp5-mst-13.2.git Re: [PATCH gv.c] allow ${"1f"} to be non-regex var Message-Id: p4raw-id: //depot/perl@11394 --- diff --git a/gv.c b/gv.c index e4951a0..b049218 100644 --- a/gv.c +++ b/gv.c @@ -938,6 +938,17 @@ Perl_gv_fetchpv(pTHX_ const char *nambeg, I32 add, I32 sv_type) case '7': case '8': case '9': + /* ensures variable is only digits */ + /* ${"1foo"} fails this test (and is thus writeable) */ + /* added by japhy, but borrowed from is_gv_magical */ + + if (len > 1) { + const char *end = name + len; + while (--end > name) { + if (!isDIGIT(*end)) return gv; + } + } + ro_magicalize: SvREADONLY_on(GvSV(gv)); magicalize: