We have files that arrive in a directory and from the name of each file we extract a string $function . This is a function name defined in a module.
We then build a command with that $function and do an eval on it.
The reason we do this is because the files, functions, and modules holding them are defined by some other people so it's convenient for us : we just drop their modules in our lib directory and processing of new file types is automatic .
But we do this a lot of time (there are many files) and I've heard that eval is not good and not very performant.
Also this looks like the $$value problem, ie "i want to get a variable value from another variable" which, as i've seen here in the monastery, should be replaced by a hash solution .
Should we avoid the eval ?
Should we do &$function ? (no strict )
Should we do something else ?
Thanks for your advices !
In reply to Calling a sub from a variable ? by ZlR
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |