good chemistry is complicated, and a little bit messy -LW |
|
PerlMonks |
Re: ref == "REF"by adamk (Chaplain) |
on Oct 19, 2004 at 01:53 UTC ( [id://400382]=note: print w/replies, xml ) | Need Help?? |
I'm not sure what everyone is so confused about... A SCALAR is a reference to a scalar. A REF is a reference to a reference. A SCALAR is a reference to data. A REF is a reference to a pointer (of sorts). Personally, I use it all time for writing Decorator classes. Go take a look at Object::Destroyer in CPAN, it wraps around another object containing circular references and makes sure it gets destroyed normally.
So if you Scalar::Util::reftype $Destroyer, you get 'REF'. Which is as it should be because unlike $Object, which could be B<anything> of any type, $Destroyer just points directory to the object it is Decorating
In Section
Seekers of Perl Wisdom
|
|