in reply to Not returning scalars(SV) to optimize and save memory?
Regarding the memory used here, Perl will actually hold onto the memory used for creating a variable, even a lexical, in order to make it faster the next time through the sub. So, it won't cost you more memory to keep calling a sub that creates a return value, and it won't need to allocate the memory again after the first time through unless you put a much larger chunk of data into it.