Hi,
This is my first question here, so apologizes if is something wrong in my questions ...

Two questions:
1. Is there any hack / cpan module that makes something like next code legitimate in perl ?
Imagine you have a hash of hashes, and you want iterate over it, but you don't want to have to write foreach many times (only one better ;)). I'm adding three new features (foreach my @array, keys_it which return iteratively keys which are writen like "*" in its argument)
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'm boring writting foreach many times ;)
foreach my $key1 (keys %{$a{key1}...}) { my $level1=$a{key1}{$key1}; foreach my $key2 (keys %{$level1->{key2}}) { ... } }
I know, this is a stupid question, but who knows maybe there is something like that, and I didn't found it !
2. Is there an hash shell explorator or even better an ncurses hash explorator?
Imagine again:
%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
c
Thanks! Updated Jun 11th 2011: I found Data::DPath which is a concept like my first issue in this post ! Thanks!

In reply to Two questions about hashes by i5513

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.