http://www.perlmonks.org?node_id=419849


in reply to Memory leaks and reference counting within Perl.

Devel::Peek enables you to see the reference counts of variables, among a lot of other things. You need to understand some of what goes on "under the hood", for which I found Simon Cozens' Perl 5 Internals tutorial very useful.

I think that playing with Dump (which is a Devel::Peek function) will shed some light on how things work.

Arjen