in reply to Re^4: read flat file and build tree-like structure
in thread read flat file and build tree-like structure
There's no problem with asking follow up questions.
1. Just like
DiveVal(\%hash, map \$_, @elts) = $val;
it does
$hash{ $elts[0] }{ $elts[1] }...{ $elts[n-1] } = $val;
If you have data like
foo.bar=val foo.bar.baz=val
you'd be better off with pc88mxer's updated code.
2. Keys can be added and removed, not changed. However, combining a removal and an addition is easy.
$hash{$new_key} = delete $hash{$old_key};
or
$hash{$new_key} = delete $hash{$old_key} if exists $hash{$old_key};
|
|---|