resistance has asked for the wisdom of the Perl Monks concerning the following question:
I am doing a traversing of filesystem and try to autovivificate the hash. The problem - I don't know how to insert multiple keys in hash:
#!/usr/bin/perl use strict; use warnings; use Data::Dumper; my %hash; my $a="{5}{6}"; # path to insert # trying to get $hash{root}{1}{5}{6}{2}="b"; $hash{root}{1}{$a}{2}="b"; print Dumper(%hash);
but I get $hash{root}{1}{'{5}{6}'}{2}="b". How to get $a interpolated as part of the "path" instead of single key?
Thanks!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Case of autovivification
by ikegami (Patriarch) on Oct 11, 2008 at 15:32 UTC | |
|
Re: Case of autovivification
by JavaFan (Canon) on Oct 11, 2008 at 16:27 UTC | |
by resistance (Beadle) on Oct 11, 2008 at 17:17 UTC | |
by toolic (Bishop) on Oct 11, 2008 at 21:13 UTC | |
by ikegami (Patriarch) on Oct 11, 2008 at 18:06 UTC | |
by ig (Vicar) on Nov 05, 2008 at 04:58 UTC |