in reply to Re^2: How to dereference a FORMAT reference?
in thread How to dereference a FORMAT reference?

I think it is even simpler:

Consider:

use strict; use Scalar::Util qw(weaken isweak); my $a = []; my $r1 = $a; my $r2 = $a; weaken $r1; print "a is weak\n" if isweak $a; print "r1 is weak\n" if isweak $r1; print "r2 is weak\n" if isweak $r2;

So here we have a array_ref $a of which we make two further copies for which we prove again that they are different.

So to answer your initial question:

Given a reference you simple assign it to a scalar to get another reference to the same referent - no need for special syntax or type-glob fiddling...

Replies are listed 'Best First'.
Re^4: How to dereference a FORMAT reference?
by Jeffrey Kegler (Hermit) on Jun 24, 2009 at 15:41 UTC
    You're 100% right. It's so simple and obvious that I never suspected. Thanks.