my $foo = "Foo!\n"; sub makefoo { *foo = sub { print $foo }; } makefoo(); foo();