Pathologically Eclectic Rubbish Lister | |
PerlMonks |
Re: typeglob/symbolic reference questionby 7stud (Deacon) |
on Nov 04, 2010 at 02:31 UTC ( [id://869390]=note: print w/replies, xml ) | Need Help?? |
Hmmm...maybe the answer to my first post is simply: you can assign to a type glob, *{"color"}, but you can't assign to a subroutine, &{"color"}.
Therefore, if you have a string and you want to dynamically define a function of the same name and then execute the function, you can: 1) Use the string to retrieve a typeglob and then assign a subroutine to the typeglob, which serves to define the function.
2) Subsequently, use the the string as a symbolic reference to retrieve the function and execute it.
In Section
Seekers of Perl Wisdom
|
|