Perl 代码:
sub fun {
my $id = { name => "123",
full_name => "345"
};
return $id;
}
my $var = fun();
print(...)
如何打印姓名和全名?
答案 0 :(得分:6)
您的函数返回对哈希的引用。您需要dereference您感兴趣的密钥:
const findAndUpdate = (obj, array, val) =>
setPath (array) (val) (obj)