Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic

Re: Return value from function

by bloonix (Monk)
on Jul 12, 2007 at 17:35 UTC ( #626286=note: print w/replies, xml ) Need Help??

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 ?

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://626286]
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (6)
As of 2023-12-08 09:44 GMT
Find Nodes?
    Voting Booth?
    What's your preferred 'use VERSION' for new CPAN modules in 2023?

    Results (35 votes). Check out past polls.