R
Richard Trahan
Consider the following code:
use strict;
{
my $x = 5;
our $sr = sub { print "$x\n"; };
}
&$sr;
This code gives a scope error, but if I remove 'use strict',
it works ok.
The 'our $sr' statement should make an entry in the SCALAR
slot of *main::sr, right? And the &$sr should retrieve only
that value, right?
What am I missing here?
Thanks.
use strict;
{
my $x = 5;
our $sr = sub { print "$x\n"; };
}
&$sr;
This code gives a scope error, but if I remove 'use strict',
it works ok.
The 'our $sr' statement should make an entry in the SCALAR
slot of *main::sr, right? And the &$sr should retrieve only
that value, right?
What am I missing here?
Thanks.