sub ModName::TIESCALAR { my $class = shift; my $self; return bless(\$self, $class); } sub test { my $var; tie $var, 'ModName'; return \$var; } my $ref = test(); print(tied($$ref) ? 'tied' : 'not tied', "\n"); # tied