2011年10月19日 星期三

Perl:A reference to reference


#aReftoRef.pl


@arr= (1..10);
$ref = \@arr;
print $ref,"\n";            #ARRAY(0x104a14a0)
$another_ref = \$ref;
$another_ref2 = \$ref;


#Note:get the same address of ref!
print $another_ref,"\n";    #REF(0x104a1770)
print $another_ref2,"\n";   #REF(0x104a1770)
print @$$another_ref,"\n";  #12345678910

沒有留言:

張貼留言