in reply to Re: The number of references to a variable
in thread The number of references to a variable

SvREFCNT is exposed in Devel::Peek (no need to go to CPAN), which is a bit easier to use than embedding XS. For example:
use Devel::Peek qw(SvREFCNT); $x = 42; $y = \$x; $refs_for_x = SvREFCNT($x); print "$refs_for_x\n";
Prints 2.