diff options
author | Hugo van der Sanden <hv@crypt.org> | 2007-05-30 14:21:15 +0100 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2007-05-30 13:59:17 +0000 |
commit | 46c458a0aac497162070e892c9801b12c9c3ac48 (patch) | |
tree | 81b0ba07fb9d3f5a167ab3c4670f3605b0c01f48 | |
parent | 370462a2c1be6d2588dcfa0aeab1b13e61e59d0c (diff) | |
download | perl-46c458a0aac497162070e892c9801b12c9c3ac48.tar.gz |
Re: localising hash element by variable
Message-Id: <200705301221.l4UCLFwf010411@zen.crypt.org>
p4raw-id: //depot/perl@31311
-rwxr-xr-x | t/op/local.t | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/t/op/local.t b/t/op/local.t index 489f409a59..e95615e9fc 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); +} |