use strict; use Data::Diver 'DiveVal'; use Data::Dump 'dd'; my $root= { top => [ { first => 1 }, { second => { key => [ 0, 1, 2, { three => { exists => 'yes', }, }, ], }, }, ], }; DiveVal($root, qw/top 1 second key 3 three exists/) = 'no'; dd($root); #### { top => [ { first => 1 }, { second => { key => [0, 1, 2, { three => { exists => "no" } }] } }, ], }