##
% perl rec_walk.pl
Can't call method "List::Util::reduce" on unblessed reference at rec_walk.pl line 9.
##
##
use strict;
my %myhash;
$myhash{bedrock}{flintstone}{fred} = 3;
my $ref = pointer_to_element(\%myhash, qw(bedrock flintstone fred));
sub pointer_to_element {
require List::Util;
return List::Util::reduce { \($$a->{$b}) } \shift, @_;
}
##
##
use List::Util 'reduce';
sub pointer_to_element {
return reduce { \($$a->{$b}) } \shift, @_;
}