perl hash ,hash 引用

perl hash  ,hash 引用:

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


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

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



解hash引用:

[ucd@hgagent perl]$ cat test.pl
%a=('a'=>1,'b'=>2);
print %a;
print "
";
$b=\%a;
print $b;
print "
";
print %{$b};
print "
";
[ucd@hgagent perl]$ perl test.pl
a1b2
HASH(0x1d7d618)
a1b2
原文地址:https://www.cnblogs.com/hzcya1995/p/13348466.html