为什么打印8
?为什么不$e
改变$i
?
my $i = 8;
sub u
{
return \$i;
}
my $e = u();
$e = "eer";
print $i; #8
答案 0 :(得分:8)
引用不是别名。你必须明确地取消引用它们。
$$e = "eer"; # Store 'eer' into the variable referenced by $e
与
不同$e = 'eer'; # Store 'eer' into $e, discarding its previous content