in reply to how to declare a local *subname=sub{}?

The title and problem description seem incompatible -- its unclear what is being asked

Consider this

$ perl -wle " { local *foo = sub { warn 6}; foo; } foo; " Unquoted string "foo" may clash with future reserved word at -e line 1 +. Unquoted string "foo" may clash with future reserved word at -e line 1 +. Useless use of a constant ("foo") in void context at -e line 1. Useless use of a constant ("foo") in void context at -e line 1. $ perl -wle " { local *foo = sub { warn 6}; foo(); } foo(); " 6 at -e line 1. Undefined subroutine &main::foo called at -e line 1.

What is your question?