diff options
author | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2004-02-04 19:50:05 +0000 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2004-02-04 19:50:05 +0000 |
commit | aabe9514ecdf64c885843e2a9440477e5a96d4c8 (patch) | |
tree | f63a69f14007384f868ad26cf79a2e9f2b0c9800 /t/op/mydef.t | |
parent | 1c00c3fe7fa040233dde55d9b3aee6515bd7106c (diff) | |
download | perl-aabe9514ecdf64c885843e2a9440477e5a96d4c8.tar.gz |
The "my $_" wasn't nice with foreach loops.
p4raw-id: //depot/perl@22268
Diffstat (limited to 't/op/mydef.t')
-rw-r--r-- | t/op/mydef.t | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/t/op/mydef.t b/t/op/mydef.t index 700a3dc5f7..0770e78f0b 100644 --- a/t/op/mydef.t +++ b/t/op/mydef.t @@ -5,7 +5,7 @@ BEGIN { @INC = '../lib'; } -print "1..56\n"; +print "1..64\n"; my $test = 0; sub ok ($$) { @@ -66,6 +66,23 @@ $_ = "global"; ok( our $_ eq 'global', '...our $_ restored outside for my $_' ); } { + my $_ = 'local'; + for ("implicit foo") { # implicit "my $_" + ok( $_ eq "implicit foo", 'for implicit my $_' ); + /(.)/; + ok( $1 eq "i", '...m// in for implicity my $_' ); + ok( our $_ eq 'global', '...our $_ inside for implicit my $_' ); + } + ok( $_ eq 'local', '...my $_ restored outside for implicit my $_' ); + ok( our $_ eq 'global', '...our $_ restored outside for implicit my $_' ); +} +{ + my $_ = 'local'; + ok( $_ eq "postfix foo", 'postfix for' ) for 'postfix foo'; + ok( $_ eq 'local', '...my $_ restored outside postfix for' ); + ok( our $_ eq 'global', '...our $_ restored outside postfix for' ); +} +{ for our $_ ("bar") { ok( $_ eq "bar", 'for our $_' ); /(.)/; |