in reply to How to dereference a FORMAT reference?
Consider this:
use strict; use Scalar::Util qw(weaken isweak); my $a = 1; my $r1 = *main::a{SCALAR}; my $r2 = *main::a{SCALAR}; weaken $r1; print "r1 is weak\n" if isweak $r1; print "r2 is weak\n" if isweak $r2;
Here I get two copies of the typeglob. Both are references to $a but they are different one as proved by weakening one and observing that the other one has not been weakened.
So I guess you don't need the special snytax for array-refs, hash-refs etc, you just generically get a new copy of whatever is in the corresponding slot of the typeglob.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How to dereference a FORMAT reference?
by Jeffrey Kegler (Hermit) on Jun 24, 2009 at 00:52 UTC | |
by tye (Sage) on Jun 24, 2009 at 06:35 UTC | |
by morgon (Priest) on Jun 24, 2009 at 15:32 UTC | |
by Jeffrey Kegler (Hermit) on Jun 24, 2009 at 15:41 UTC |