我是perl的新手.所以问题可能听起来很幼稚.
我有两个以下功能
#This function will return the reference of the array
sub getFruits1
{
my @fruits = ('apple', 'orange', 'grape');
return \@fruits;
}
Run Code Online (Sandbox Code Playgroud)
但在以下情况下?
#How it returns?
sub getFruits2
{
my @fruits = ('apple', 'orange', 'grape');
return @fruits;
}
Run Code Online (Sandbox Code Playgroud)
是否会getFruits2返回引用并创建该数组的新副本?