You can't even return an array in Perl (you can return a reference to an array and you can write "return @array;" but that returns (a copy of) the list of scalar values that are in the array).
This is not 100% correct. The array is returned from the function. But to get a hold of it, you should COPY it somewhere. Either in another array, or into list of variables. Or where ever.
perl -e 'sub test{my @a=qw(a b c); return @a} my $v = test(); print $v
+,"\n"'
perl -e 'sub test{return qw(a b c);} my $v = test(); print $v,"\n"'
perl -e 'sub test{my @a=qw(a b c); return @a} my ($a, $v) = test(); pr
+int $v,"\n"'
perl -e 'sub test{my @a=qw(a b c); return (@a)} my $v = test(); print
+$v,"\n"'
perl -e 'sub test{my @a=qw(a b c); return (@a, "b")} my $v = test(); p
+rint $v,"\n"'
Everything in perl becomes logical if you think about @abc as about OBJECT, and about list as COLLECTION of objects. So obtaining a slice from the array gives you collection of objects. grep or map work with collections of objects, so if you pass array to them, this array is turned into collection of objects. Of course, neither grep nor map can return array since they have only collection of objects as input.
Placing array as member into collection/list does not make this array disappear. It stays in the list as the object. But when the list is copied somewhere, then the array object might be replaced with its elements. Depends on the context.