This is often true, so I can understand why an eval might be necessary. What, exactly, is the source of the scalar? Is this being built at runtime? If so, eval might be the answer. If it's a bunch of static code snippets that can be determined at compile time, a hash of coderefs is faster and safer.
Cheers,
Ovid
Join the Perlmonks Setiathome Group or just click on the the link and check out our stats.
| [reply] |
| [reply] |
If the code is coming from untrusted sources, definitely look into using Safe.pm and restrict the hell out of the permitted opcodes.
| [reply] |