http://www.perlmonks.org?node_id=1009062


in reply to Re: Dynamic Package Name & Subroutine Call
in thread Dynamic Package Name & Subroutine Call

The following works with strict on:
(\&{"Test::${pkg}::hello"})->($pkg);
The same, but more readable:
my $sub = \&{"Test::${pkg}::hello"}; $sub->($pkg);

Then again, explicitly using no strict 'refs'; might be better a good thing.

That said, it looks like you have a method call (to which you're passing the wrong package name). If so, you should be using

("Test::".$pkg)->hello(...);