1

为什么会这样打印8?为什么不$e$i

my $i = 8;

sub u
{
    return \$i;
}

my $e = u();
$e = "eer";
print $i; #8
4

1 回答 1

8

引用不是别名。您必须明确取消引用它们。

$$e = "eer"; # Store 'eer' into the variable referenced by $e

不一样

$e = 'eer'; # Store 'eer' into $e, discarding its previous content
于 2012-05-26T18:07:19.667 回答