in reply to Dynamic Subroutines?

Answer #2: If the code will always be the same, and only the values of some variables will be different, you can make anonymous functions like this:
sub create_subroutine_to_return_constant { my ($constant) = @_; my $newsub = sub { return $constant }; return $newsub; }
Then you call it using the -> notation:
my $PI = create_subroutine_to_return_constant(3); $z = $PI->(); # returns 3
This technique is a lot more interesting than the example I showed. But I didn't want to give too much information at once.

Perhaps you could say a little more about what you are trying to accomplish here.