sub applypath{ my($val, $index, @path) = @_; if(!defined($index)){ return $val; } return applypath($val->{$index}, @path); }