use Sub::Lexical; my $foo = "a string"; # ack, $foo = sub {}; will run over previous $foo :-/ my sub foo { print "I'm in foo()\n"; }