Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: pass by value vs reference and return by value

by hippo (Curate)
on Oct 27, 2013 at 14:08 UTC ( #1059905=note: print w/ replies, xml ) Need Help??


in reply to pass by value vs reference and return by value

Objects in Perl are references anyway, specifically blessed references. Therefore when you pass an object to a subroutine you are necessarily passing by reference. For example, in the following snippet $obj is passed by reference and may be altered by munge_it()

my $obj = Some::Class->new (); munge_it ($obj, $data);

No copying of objects should have occurred here.

If you want to know why your script is slow, profile it. Much better than guessing and spending time "optimising" some part of the script which doesn't require it.

Good luck.


Comment on Re: pass by value vs reference and return by value
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (5)
As of 2014-12-28 18:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (182 votes), past polls