in reply to How do I interpolate package name in a fully qualified name?
eval works:
print "$pkg is a " . eval("\$${pkg}::type") . "\n";
Yeah, as Anon monk posted, you can do the following, but you'll have to turn off strict refs. Still can't think of a way to avoid having to play with strict.
no strict 'refs'; print "$pkg is a " . ${$pkg.'::type'} . "\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How do I interpolate package name in a fully qualified name?
by AGhoulDoingPerl (Sexton) on Apr 22, 2011 at 14:41 UTC |