my $x = "do_"; my $y = "it"; { no strict 'refs'; *{"$x$y"} = sub { print "Hello!\n" }; } do_it(); __END__ Hello!