From: Gurusamy Sarathy Date: Wed, 23 Sep 1998 06:08:46 +0000 (+0000) Subject: make \(%foo) return refs to values (not copies of values) X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=b6429b1b67c6f0e2a8a4aac1874df3fa87f9d71b;p=p5sagit%2Fp5-mst-13.2.git make \(%foo) return refs to values (not copies of values) From: Stephen McCamant Date: Fri, 28 Aug 1998 20:46:10 -0700 (PDT) Message-ID: <13799.30680.47765.352558@fre-76-120.reshall.berkeley.edu> -- From: Roderick Schertler Date: Sat, 29 Aug 1998 00:58:33 -0400 Message-ID: <29894.904366713@eeyore.ibcinc.com> Subject: Re: \(%x) problems p4raw-id: //depot/perl@1819 --- diff --git a/doop.c b/doop.c index c6270e4..a3663f9 100644 --- a/doop.c +++ b/doop.c @@ -1067,10 +1067,9 @@ do_kv(ARGSproto) if (dokeys) XPUSHs(hv_iterkeysv(entry)); /* won't clobber stack_sp */ if (dovalues) { - tmpstr = sv_newmortal(); PUTBACK; - sv_setsv(tmpstr,realhv ? - hv_iterval(hv,entry) : avhv_iterval((AV*)hv,entry)); + tmpstr = realhv ? + hv_iterval(hv,entry) : avhv_iterval((AV*)hv,entry); DEBUG_H(sv_setpvf(tmpstr, "%lu%%%d=%lu", (unsigned long)HeHASH(entry), HvMAX(keys)+1, diff --git a/pod/perlref.pod b/pod/perlref.pod index 66b1a7d..aa4ddfb 100644 --- a/pod/perlref.pod +++ b/pod/perlref.pod @@ -89,7 +89,9 @@ a list of references! @list = \($a, @b, %c); # same thing! As a special case, C<\(@foo)> returns a list of references to the contents -of C<@foo>, not a reference to C<@foo> itself. Likewise for C<%foo>. +of C<@foo>, not a reference to C<@foo> itself. Likewise for C<%foo>, +except that the key references are to copies (since the keys are just +strings rather than full-fledged scalars). =item 3.