Uri Guttman wrote:
> On 11/08/2014 10:40 AM, Ron Bergin wrote:
>> you could accomplish it with the use of eval.
>>
>> my $foo = eval "MyFoo::${pgm}Bar->new";
>
> ewww. never use string eval for something as simple as that.
>
> my $foo = "MyFoo::${pgm}Bar"->new() ;
>
> that is just fine there. the class in a class method call is just a
> string or a bareword so there is no need for eval.
>
> uriYou're right. Using eval is a poor solution for this task. In fact, I almost never use or suggest using eval. It was just the first thing that popped into my mind. -- Ron Bergin -- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected] http://learn.perl.org/
