in reply to The number of references to a variable

As has been mentioned, Devel::Peek provides an SvREFCNT. There's also a builtin function (probably undocumented) called Internals::SvREFCNT.

Your statement:

I only want to use those objects which are referenced
didn't make a lot of sense, however. The only objects you have access to are those with references to them; if there are no references to an object then it is deallocated. Therefore, any refcount check would be guaranteed to be over 0.

I simply wanted to point that out; perhaps it was just a miscommunication. If weaken was what you were looking for, great.

  • Comment on Re: The number of references to a variable