in reply to returning large arrays from functions

Pass around a reference to the result array.   A reference (to anything...) occupies only one small slot on the runtime stack.

Bear in mind that changes to any reference to “the same thing” will be reflected in all references to that “thing.”   If you need to make a deep copy of whatever the reference points to, there are several ways to do that, e.g. dclone() in Storable.