|
|
| Do you know where your variables are? | |
| PerlMonks |
Re: Calling a subroutine from a scalarby tlm (Prior) |
| on Jun 29, 2005 at 15:47 UTC ( #471075=note: print w/ replies, xml ) | Need Help?? |
|
Your question suggests a logical confusion. One can't store a subroutine in a scalar variable. You can store a reference to a subroutine in a scalar variable, or you can, as in your code, store the name of a subroutine in a scalar variable. In the former case, the answer to your question is easy:
In the latter case, you can either use eval: or you can treat it as a symbolic ref:
But storing names of subroutines in variables should be a red flag to alert you that you are probably not thinking about the problem in the right way. the lowliest monk
In Section
Seekers of Perl Wisdom
|
|
||||||||||||||||||||