Then you access them the same as any other subroutine:sub create_subroutine_to_return_constant { my ($name, $constant) = @_; my $code = "sub $name { return $constant }"; eval $code; }
create_subroutine_to_return_constant('PI', 3); $z = PI(); # returns 3
In reply to Re: Dynamic Subroutines?
by Dominus
in thread Dynamic Subroutines?
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |