[] 和{} 匿名引用

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


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 "\n";
$href={%h};
print $href;
print "\n";
print %{$href};
print "\n";

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

posted @ 2016-11-19 17:58  czcb  阅读(121)  评论(0编辑  收藏  举报