summaryrefslogtreecommitdiff
path: root/gv.c
diff options
context:
space:
mode:
authorJeff Pinyan <japhy@pobox.com>2001-07-16 14:46:53 -0400
committerNick Ing-Simmons <nik@tiuk.ti.com>2001-07-17 07:57:06 +0000
commite521374caf664d14b86b1eb0931fa32b77c9367f (patch)
tree41eceff6d0d4cced0852ad40c2a6d5135f349eed /gv.c
parent8ff9412f9ef1dbdabee4f0993653e1446d7a88c8 (diff)
downloadperl-e521374caf664d14b86b1eb0931fa32b77c9367f.tar.gz
Re: [PATCH gv.c] allow ${"1f"} to be non-regex var
Message-Id: <Pine.GSO.4.21.0107161829390.1405-100000@crusoe.crusoe.net> p4raw-id: //depot/perl@11394
Diffstat (limited to 'gv.c')
-rw-r--r--gv.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/gv.c b/gv.c
index e4951a076d..b04921894f 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: