From: Hugo van der Sanden <hv@crypt.org>
Date: Wed, 30 May 2007 13:21:15 +0000 (+0100)
Subject: Re: localising hash element by variable
X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=46c458a0aac497162070e892c9801b12c9c3ac48;p=p5sagit%2Fp5-mst-13.2.git

Re: localising hash element by variable
Message-Id: <200705301221.l4UCLFwf010411@zen.crypt.org>

p4raw-id: //depot/perl@31311
---

diff --git a/t/op/local.t b/t/op/local.t
index 489f409..e95615e 100755
--- a/t/op/local.t
+++ b/t/op/local.t
@@ -5,7 +5,7 @@ BEGIN {
     @INC = qw(. ../lib);
     require './test.pl';
 }
-plan tests => 117;
+plan tests => 120;
 
 my $list_assignment_supported = 1;
 
@@ -442,4 +442,14 @@ sub f { ok(0 == $[); }
     ok(! exists($h{'k2'}));
     is($h{'k1'},111);
 }
-
+{
+    my %h=('k1' => 111);
+    our $k = 'k1';  # try dynamic too
+    {
+	local $h{$k}=222;
+	is($h{'k1'},222);
+	$k='k2';
+    }
+    ok(! exists($h{'k2'}));
+    is($h{'k1'},111);
+}