Y'all are quick on the send button. To repeat...
I thought this is possible, but maybe I'm wrong. Ok, here's the issue:
I want to print the values of a bunch of variables so I thought I'll take a shortcut and do this:
foreach (qw(var1 var2 var3 var4)) { print "$_ -> ${$_}\n"; }
I had thought that interpolating the variable name ("${$_}") would cause
Perl to interpret the correct variable name & print its value, but it
printed nothing.
Is my syntax wrong or is this not possible at all? I checked Mr. Camel, but did not find anything there on this specifically.
Thanks,
-Nilanjan
Are the variables lexical?
"Only package variables are accessible through symbolic references, because symbolic references always go through the package symbol table." (Camel, 3rd Edition, p. 264)
$global = "GLOBAL"; my $lexical = "LEXICAL";
for (qw(global lexical)) {
print $$_, "\n";
}This prints: GLOBAL
_______________________________________________ Boston-pm mailing list [EMAIL PROTECTED] http://mail.pm.org/mailman/listinfo/boston-pm

