my $code_to_eval = ( defined $self->{$key}{path} ) ? '$tmp_record{' . join( '}{', (@{$self->{$key}{path}},$key) ) . '} = $value' : '$tmp_record{'.$key.'} = $value'; #and then I run: eval $code_to_eval or warn @_; #### csResource::Registry=HASH(0x1a6f03c)