Front page | perl.perl6.language |
Postings from September 2001
RE: What's up with %MY?
Thread Previous
|
Thread Next
From:
Dave Mitchell
Date:
September 6, 2001 03:17
Subject:
RE: What's up with %MY?
Message ID:
200109061016.LAA12123@gizmo.fdgroup.co.uk
One further worry of mine concerns the action of %MY:: on unintroduced
variables (especially the action of delete).
my $x = 100;
{
my $x = (%MY::{'$x'} = \200, $x+1);
print "inner=$x, ";
}
print "outer=$x";
I'm guessing this prints inner=201, outer=200
As for
my $x = 50;
{
my $x = 100;
{
my $x = (delete %MY::{'$x'}, $x+1);
print "inner=$x, ";
}
print "middle=$x, ";
}
print "outer=$x";
If delete 'reexposes' an outer version of that variable, then I'd speculate
the output would be
inner=51, middle=50, outer=50
Thread Previous
|
Thread Next