http://www.perlmonks.org?node_id=1071769


in reply to Dynamically requiring a module

Another option besides what has already been given would be to use Module::Load.

use Module::Load; my $config = 'Config'; my $settings = 'Settings'; my $ver = 3; load $ver > 2 ? $config : $settings;