in reply to More efficient dereferencing of a subroutine return
my @ARRAY=subroutine(); sub subroutine { my @array=("one", "two"," three"); return @array; }
If you still need to return an array-ref in other cases just check wantarray in a condition to see if a scalar is expected.
return wantarray ? @array : \@array;
Cheers Rolf
|
|---|