[] 和{} 匿名引用

[] 数组引用:
Vsftp:/root/perl/6# cat a7.pl 
use Data::Dumper;
my @fields=("aa","bb","cc","dd");
$ref=[@fields];
print $ref;
print "
";
print @{$ref};
print "
";


Vsftp:/root/perl/6# perl a7.pl 
ARRAY(0xa92408)
aabbccdd

{} hash引用
Vsftp:/root/perl/6# cat a8.pl 
%h=("a"=>"1","b"=>"2");
print %h;
print "
";
$href={%h};
print $href;
print "
";
print %{$href};
print "
";

Vsftp:/root/perl/6# perl a8.pl 
a1b2
HASH(0xe79408)
a1b2

原文地址:https://www.cnblogs.com/zhaoyangjian724/p/6198975.html