{ # start a scope here to prevent interference with anything else my $test = \&main::test1; # only need this once as they are the same *main::test1 = sub { print " @_\n"; goto &$test }; *main::test2 = sub { print " @_\n"; goto &$test }; } # $test kept because still refs in the anonymous subs