$VAR1 = { 'misc' => {}, 'docs' => { 'howtos' => { 'email' => { 'index.html' => { 'date' => '21-1-2004', 'size' => '691' } }, 'ftp' => {}, 'ssh' => {} } } }; #### # yes, I realise there is NO error checking :) # assume $tree contains data structure shown above # assume input = "/docs/howtos/email/" my $string = join('}->{',split(/\//,$input)); $string =~ s/^.(.+)/$1}/; $string = '$tree'.$string."->{'index.html'}->{size};"; # string now contains: "$tree->{docs}->{howtos}->{email}->{'index.html'}->{size};" # constructed reference print eval $string; # explicit reference print $tree->{docs}->{howtos}->{email}->{'index.html'}->{size};