sub foo1 { print 'Foo! One' }; sub foo2 { print 'Foo! Two' }; use vars '$output'; sub bar { $output->(); }; local $output = \&foo1; bar(); local $output = \&foo2; bar();