[ 7:53:35.32] P:\test>perl -l
my $globref = \do { local *GLOB };
print $globref;
## Assign to the SCALAR slot in the glob referenced by $globref
${ *$globref } = 123456789;
print $globref; ## Still a GLOB
print ${ *$globref }; ## Contains our value
## This is where the trouble comes in.
*$globref = sub{ print 'test' };
print ${ *$globref }, $/, &{ *$globref };
^Z
GLOB(0x224fc8)
GLOB(0x224fc8)
123456789
Not a GLOB reference at - line 13.
####
[ 7:56:55.39] P:\test>perl -l
my $globref = do { local *GLOB; \*GLOB; };
print $globref;
## Assign to the SCALAR slot in the glob referenced by $globref
${ *$globref } = 123456789;
print $globref; ## Still a GLOB
print ${ *$globref }; ## Contains our value
## This is where the trouble comes in.
*$globref = sub{ print 'test' };
print ${ *$globref }, $/, &{ *$globref };
^Z
GLOB(0x1824284)
GLOB(0x1824284)
123456789
test
123456789
1
####
my $globref = \ do{ local *GLOB; };