数组 – 如何在哈希中插入哈希哈希值?
发布时间:2020-12-16 06:07:53 所属栏目:大数据 来源:网络整理
导读:我想从一个空哈希开始,然后在哈希中插入相同类型的哈希哈希. #!/usr/bin/perluse strict;use warnings;my %h = {};$h{"1"} = { a = -1,b = -1,c = [ { d = -1,e = -1,},],}; 但是这给了 Useless use of hash element in void context at ./hash.pl line 8.Us
我想从一个空哈希开始,然后在哈希中插入相同类型的哈希哈希.
#!/usr/bin/perl use strict; use warnings; my %h = {}; $h{"1"} => { a => -1,b => -1,c => [ { d => -1,e => -1,},],}; 但是这给了 Useless use of hash element in void context at ./hash.pl line 8. Useless use of anonymous hash ({}) in void context at ./hash.pl line 8. Reference found where even-sized list expected at ./hash.pl line 6. 它是我想要的数据库,我可以在其中插入$h {“1”}种类的删除结构. 任何想法如何做到这一点? 解决方法
要初始化哈希,请使用%h =().
{}是一个空的匿名哈希值 reference.试试这个: my %h = (); $h{"1"} = { a => -1,c => [{ d => -1,}],}; (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |