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. > > uri
You'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: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/