It isn't completely clear to me what you want to do; is
&code_to_create_new a subroutine that you want to produce on the fly based on the falsity of $name?
If you exhibit the block of code you refer to, that would clarify things.
(You don't want a goto, do you?)
chas