I have a Perl program, that needs to use packages (that I also write). Some of those packages are only chosen in Runtime (based on some environment variable). I don’t want to put in my code a ‘use’ line for all of those packages, of course, but only one ‘use’ line, based on this variable, something like:
use $ENV{a};
Unfortunately, this doesn’t work, of course. Any ideas on how to do this?
Thanks in advance, Oren
‘
use‘ doesn’t work well here because it only imports in the context of theeval.As @Manni said, actually, it’s better to use require. Quoting from
man perlfunc: