i5513 has asked for the wisdom of the Perl Monks concerning the following question:
Hi,
This is my first question here, so apologizes if is something wrong in my questions ...
I'm boring writting foreach many times ;)my %a; $a{key1}{a}{key2}{b}{key3}{c}{key4}{d}=1; $a{key1}{a}{key2}{b}{key3}{d}{key4}{c}=1; foreach my ($a, $b, $c, $d) (keys_it $a{key1}{*}{key2}{*}{key3}{*}{key4}{*}) { whateveryouwant with your elements of %a; }
I know, this is a stupid question, but who knows maybe there is something like that, and I didn't found it !foreach my $key1 (keys %{$a{key1}...}) { my $level1=$a{key1}{$key1}; foreach my $key2 (keys %{$level1->{key2}}) { ... } }
%a={a => {b => c}, b => 3}; open FILE, "myhash.txt"; print FILE Dumper (%a); cloes FILE
$ hash_shell myhash.txt > ls a b > cd a > ls b > cd b > ls cThanks! Updated Jun 11th 2011: I found Data::DPath which is a concept like my first issue in this post ! Thanks!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Two questions about hashes
by JavaFan (Canon) on May 30, 2011 at 21:45 UTC | |
by i5513 (Pilgrim) on May 30, 2011 at 22:03 UTC | |
by ig (Vicar) on May 31, 2011 at 09:21 UTC | |
by i5513 (Pilgrim) on Jun 01, 2011 at 09:47 UTC | |
by ig (Vicar) on Jun 02, 2011 at 05:47 UTC | |
| |
|
Re: Two questions about hashes
by ig (Vicar) on May 31, 2011 at 06:54 UTC | |
by i5513 (Pilgrim) on Jun 02, 2011 at 08:38 UTC | |
|
Re: Two questions about hashes
by anonymized user 468275 (Curate) on May 31, 2011 at 09:32 UTC | |
by Anonymous Monk on May 31, 2011 at 13:17 UTC | |
by i5513 (Pilgrim) on Jun 02, 2011 at 20:18 UTC | |
by i5513 (Pilgrim) on Jun 02, 2011 at 20:13 UTC |