Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical

Re^2: Thorny design problem

by mpeters (Chaplain)
on Sep 07, 2005 at 21:40 UTC ( #490007=note: print w/replies, xml ) Need Help??

in reply to Re: Thorny design problem
in thread Thorny design problem

No, this won't actually work. From perldoc:
But if you try this:
$class = ’Foo::Bar’; require $class; # $class is not a bareword #or require "Foo::Bar"; # not a bareword because of the ""
The require function will look for the "Foo::Bar" file in the @INC array and will complain about not finding "Foo::Bar" there. In this case you can do:
eval "require $class";
But you could do:
my $module = 'Crunch/' . $company .'.pm'; require $module;

-- More people are killed every year by pigs than by sharks, which shows you how good we are at evaluating risk. -- Bruce Schneier