dingbob has asked for the wisdom of the Perl Monks concerning the following question:
I get the error Can't use string ("bob") as an ARRAY ref while "strict refs" in use at 1 line 9., which is expected (after much googling, I understand why).use strict; use warnings; my %hash; $hash{a} = 'bob'; $hash{b} = 'mary'; $hash{a}[0] = 1;
extended config:a = bob b = mary
When building my %hash, if $hash{a} is already defined, then I want to store any duplicate key names in the hash (hence my reaching for an array).a = bob a = 1 b = mary
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Extending a hash
by moritz (Cardinal) on Apr 21, 2011 at 10:23 UTC | |
|
Re: Extending a hash
by anonymized user 468275 (Curate) on Apr 21, 2011 at 10:21 UTC | |
by bart (Canon) on Apr 21, 2011 at 11:26 UTC | |
by anonymized user 468275 (Curate) on Apr 21, 2011 at 11:32 UTC | |
|
Re: Extending a hash
by apl (Monsignor) on Apr 21, 2011 at 10:37 UTC |