$ perl -MO=Deparse,-x7 -e'Foo::Bar->new()' 'Foo::Bar'->new; -e syntax OK
Pay attention to the quotes: as far as Perl is concerned, class methods are always invoked on a string containing the package name. Whether that's a literal string or one stored in a variable matters naught.
Makeshifts last the longest.
In reply to Re: $foo = "Foo::Bar"; $foo->new() works?
by Aristotle
in thread $foo = "Foo::Bar"; $foo->new() works?
by mikfire
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |