http://qs321.pair.com?node_id=626286


in reply to Return value from function

In most times it's better to pass references between functions, otherwise it would copy the data and if the hash or array is too big it blows your memory away. The other thing is that if you know that the function manipulate the data and you need the original then you should pass a copy.

Replies are listed 'Best First'.
Re^2: Return value from function
by perlCrazy (Monk) on Jul 12, 2007 at 17:47 UTC
    Thanks for reply.
    Is this the best option ? why not pass reference then copy locally instead of returning from function directly.
    How much difference this will make and what should be the best prcatice.
    Also if checking the retrun value from calling function, in case of Hash, if we do like that if (%hash), then this will
    not work in all case. If we return ref, then we can test easily like that, if ($ref). Any suggestions or opinion ?