while (@parts) { my $part = shift @parts; $parent = $parent->{$part} ||= {}; next if @parts; $parent->{_name_} = $protein; }