如何在Perl中引用特定的哈希值?
发布时间:2020-12-15 21:44:30 所属栏目:大数据 来源:网络整理
导读:如何在特定哈希键中创建对值的引用.我尝试了以下但是$$foo是空的.任何帮助深表感谢. $hash-{1} = "one";$hash-{2} = "two";$hash-{3} = "three";$foo = ${$hash-{1}};$hash-{1} = "ONE";#I want "MONEY: ONE";print "MONEY: $$foon"; 解决方法 use strict;
如何在特定哈希键中创建对值的引用.我尝试了以下但是$$foo是空的.任何帮助深表感谢.
$hash->{1} = "one"; $hash->{2} = "two"; $hash->{3} = "three"; $foo = ${$hash->{1}}; $hash->{1} = "ONE"; #I want "MONEY: ONE"; print "MONEY: $$foon"; 解决方法use strict; use warnings; my $hash; $hash->{1} = "one"; $hash->{2} = "two"; $hash->{3} = "three"; my $foo = $hash->{1}; $hash->{1} = "ONE"; print "MONEY: $$foon"; (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |