in reply to symbolic references
As for what you're doing wrong, lexical variables don't enter the symbol table. And, if you don't understand that statement, then you really shouldn't be playing with symbolic references. Hashes, my brother. Hashes.use strict; use warnings; # Assuming you're using Perl 5.6.0 and higher my %vars = ( 'A' => 'This is varA', 'B' => 'This is varB', 'C' => '', ); my @vars = qw( A B C ); foreach my $varname ( @vars ) { print "$varname is $vars{ $varname }\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: symbolic references
by Anonymous Monk on Sep 27, 2005 at 19:24 UTC | |
by dragonchild (Archbishop) on Sep 27, 2005 at 19:48 UTC |