0

I am trying to dynamically call the use command by doing something like

   eval { use $modulename ;} ; 

but the compiler complains about the syntax. Is there an easy way of using the "use $modulename" only if needed ? As I want to determine which module to use depending on the user's input and interpolate the use $modulename dynamically.

Any input on this will be highly appreciated.

aleroot
  • 71,077
  • 30
  • 176
  • 213
  • 5
    [How can I dynamically include Perl modules without using eval?](http://stackoverflow.com/questions/1917261/how-can-i-dynamically-include-perl-modules-without-using-eval) – rutter Aug 27 '13 at 20:42
  • Something that the linked answers don't cover: `eval BLOCK` isn't "dynamic" or "interpolating" anything. Only `eval $string` does that. – hobbs Aug 27 '13 at 21:51

0 Answers0