eval 'require $module_name';
Nope. Between single quotes, variables are not interpolated. You would have to say
eval qq{require '$module_name'};
But then, to import() - as chromatic pointed out - you have to strip the .pm suffix.
In reply to Re: import() when require-d module name is variable
by shmem
in thread import() when require-d module name is variable
by akujbida
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |