in reply to Interpolating Variables as Package Names
Update:: gaal is absolutely right, the code will not show the correct package variable. I was more focused on showing how to load modules at runtime. Roy Johnson seems to have the interpolation part worked out.#!/usr/bin/perl; unshift @INC, "/path/to/package"; print "Interpolate variables from which package? "; $package = <STDIN>; chomp($package); eval "require $package"; print <<EOF; This variable: $package::variable (actually this doesn't work) originates in package $package. EOF
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Intropating Variables as Package Names
by gaal (Parson) on Mar 09, 2005 at 20:27 UTC |