use strict; sub _foo { ... } LAX: { $caller = caller; no strict 'refs'; *{"$caller\::foo"} = \&_foo; }