in reply to Re^4: access to sub of package
in thread access to sub of package
Because the later is a method lookup (which allows a scalar containing a package name to be used) while the former is a syntax error (you've named a scalar $usage in the package var, then you're trying to call it as a function). If you need to call something in a dynamically determined package you'll need to use eval or something like { no strict 'refs'; &{"${var}::usage"}( ) }).
|
|---|