perl hash ,hash 引用

perl hash  ,hash 引用:

[ucd@hgagent perl]$ cat test.pl
%a=('a'=>1,'b'=>2);
print %a;
print "\n";
[ucd@hgagent perl]$ perl test.pl
a1b2


[ucd@hgagent perl]$ cat test.pl
%a=('a'=>1,'b'=>2);
print %a;
print "\n";
$b=\%a;
print $b;
print "\n";

[ucd@hgagent perl]$ perl test.pl
a1b2
HASH(0x668618)



解hash引用:

[ucd@hgagent perl]$ cat test.pl
%a=('a'=>1,'b'=>2);
print %a;
print "\n";
$b=\%a;
print $b;
print "\n";
print %{$b};
print "\n";
[ucd@hgagent perl]$ perl test.pl
a1b2
HASH(0x1d7d618)
a1b2
发布了3883 篇原创文章 · 获赞 120 · 访问量 360万+

猜你喜欢

转载自blog.csdn.net/zhaoyangjian724/article/details/105265884