将子例程的结果分配给数据副本吗?(Does assigning the result of a subroutine result in a copy of the data?)

编程入门 行业动态 更新时间:2024-10-27 03:26:52
将子例程的结果分配给数据副本吗?(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?

更多推荐

本文发布于:2023-07-26 15:50:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1277574.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:副本   例程   数据   assigning   data

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!