#!/usr/bin/perl use strict; use warnings; use Data::Dumper; use feature 'say'; use Data::DRef qw( :dref_access :key_access ); my $complex = { key_of_hash => { opt1 => 'val1', opt2 => 'val2', key_of_hash_of_hashes => { opt3 => 'val3', opt4 => 'val4', } }, key_of_arr => [ 38, 'abc', -1829, ['element0', 8979, 'something else'] ] }; # say get_value_for_dref($complex, 'key_of_arr.3.0'); # print Dumper get_value_for_key($complex, 'key_of_hash'); # say get_value_for_keys($complex, 'key_of_hash', 'key_of_hash_of_hashes', 'opt3'); # print Dumper $complex;