use B; sub refcheck { my $ref = shift; return ref(B::svref_2object($ref)) =~ /B::(\w+)/; }