将子例程的结果分配给数据副本吗?(Does assigning the result of a subroutine result in a copy of the data?)
我试图了解是否分配子例程的结果导致复制该数据。
sub maketext { 'text' }; my $foo = maketext(); my $foo_ref = \$foo; my $bar_ref = \maketext();在上面的例子中,创建$foo_ref是否会创建一个比创建$bar_ref更多的副本?
我如何说服自己等同或不等同?
I'm trying to understand if assigning the result of a subroutine results in the copying of that data.
sub maketext { 'text' }; my $foo = maketext(); my $foo_ref = \$foo; my $bar_ref = \maketext();In the above example, will the creation of $foo_ref result in one more copy than the creation of $bar_ref?
How can I convince myself of their equivalence or unequivalence?
更多推荐
发布评论