【发布时间】:2012-10-03 11:04:30
【问题描述】:
我是 perl 的新手。所以这个问题听起来有点幼稚。
我有以下两个功能
#This function will return the reference of the array
sub getFruits1
{
my @fruits = ('apple', 'orange', 'grape');
return \@fruits;
}
但是在以下情况下呢?
#How it returns?
sub getFruits2
{
my @fruits = ('apple', 'orange', 'grape');
return @fruits;
}
getFruits2 会返回一个引用并创建该数组的新副本吗?
【问题讨论】:
标签: perl function return-type