my $sub; BEGIN { $sub = sub { my ($called) = (caller(0))[3]; warn "Called as <$called>\n"; }; *{ bar } = $sub; } my $b = \&bar; $sub->(); *{ foo } = $sub; foo(); bar(); $b->(); *{ baz } = $b; baz();