in reply to Dynamic Subroutines?

Answer #1: You create them with eval:
sub create_subroutine_to_return_constant { my ($name, $constant) = @_; my $code = "sub $name { return $constant }"; eval $code; }
Then you access them the same as any other subroutine:
create_subroutine_to_return_constant('PI', 3); $z = PI(); # returns 3