Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I thought that Perl would substitute "bar" into %$foo to make it %bar, but apparently it does not. I get the errors:use strict; use warnings; my $foo = "bar"; my %$foo=("key1"=>"value1","key2"=>"value2"); print $bar{"key1"};
"my" variable $foo masks earlier declaration in same scope at test.pl line 6. Can't declare hash dereference in my at test.pl line 6, near "$foo=" Global symbol "%bar" requires explicit package name at test.pl line 7. Execution of test.pl aborted due to compilation errors.Suggestions? Thanks.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Hash references?
by FunkyMonk (Bishop) on May 02, 2008 at 18:50 UTC | |
|
Re: Hash references?
by pc88mxer (Vicar) on May 02, 2008 at 18:49 UTC | |
|
Re: Hash references?
by ikegami (Patriarch) on May 02, 2008 at 22:19 UTC | |
by Anonymous Monk on May 03, 2008 at 06:22 UTC | |
|
Re: Hash references?
by linuxer (Curate) on May 02, 2008 at 21:18 UTC |