Reputation: 3176
This works:
A::B->new();
This doesn't:
my $m = 'A::B->new';
&{\&{$m}};
How can I make it work? The strange syntax does work for regular functions not containing "->".
Upvotes: 3
Views: 68
Reputation: 66937
Sounds like you want
my $pkg = 'A::B';
my $method = 'new';
$pkg->$method;
Upvotes: 4