# build the hash-tree for this path my $ref=\$tree; $ref = \$$ref->{$_} ||= {} for(@parts);