http://www.perlmonks.org?node_id=1073031


in reply to Re^6: Creating flexible method accessor
in thread Creating flexible method accessor

Then you might want to start looking into CPAN modules, for example a really quick search brings up Data::Path.

Otherwise, although I would really try to avoid string eval as much as possible, when it is used it's best to limit its scope as much as possible: $self = eval qq{ \$self->$path }; die $@ if $@;