Ah, a wheel waiting to be re-invented. ;-)
The do function will do exactly what you describe: read in a file, compile it as Perl, and execute it. It's been around a while, and there are many better alternatives, such as require and use. For more information on the latter two, look at perlmod.
However, being able to load and run a file will not make your program dynamic. You can't use stuff like this to replace an existing function definition, only to add a new one. What you want can be done, but requires more work: you need a level of indirection, so you can change the definition but keep the name. Possible, but difficult and very error-prone. Do you have a specific use in mind? (Other than "neat!" -- a valid reason, mind you.)
In reply to Re: dynamic sub routine definitions?
by VSarkiss
in thread dynamic sub routine definitions?
by Eradicatore
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |