in reply to Hash to Hash to Hash ....
Note, however, that the set sub does not do auto vivification of hash keys for you. This might be regarded a feature, but probably isn't.# traverse($hoh, @key): return value of $hoh->{$key[0]}...{$key[-1]} sub traverse { my $hoh = shift; $hoh = $hoh->{$_} for (@_); $hoh } # set($hoh,$val, @path): ... sub set { my $hoh = shift; my $val = shift; my $last = pop @_; $hoh = $hoh->{$_} for (@_); $hoh->{$last} = $val }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
more Hash to Hash to Hash ....
by wertert (Sexton) on Aug 21, 2001 at 14:04 UTC | |
by wertert (Sexton) on Aug 21, 2001 at 14:10 UTC |