Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
Dear Perl Monk friends, I am primarily a C++ programmer and now learning perl. This question is to know difference between pass by value vs reference to function in perl and C++. C++ recommends pass-by-reference to avoid object copying overhead, since pass-by-value involves copy of the object being passed to function. Also, when we return an object (return-by-value) from a C++ function, it involves a temp object creation & destruction. perl also allows pass-by-reference to functions. Also, we can return values or references from perl functions. In this context, does pass-by-reference and return-by-reference help to avoid object copying overhead in perl also? I am trying to optimize my perl script so that when there are many functions, I want to reduce/eliminate the overhead of object copying while passing them to and returning from functions. I've a perl script which parses lot of data from web & it takes too long to process the data. That's why I am looking at these aspects in my script. Many thanks for clarifying my query. Best Regards ganesh

In reply to pass by value vs reference and return by value by ganeshPerlStarter

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (9)
As of 2024-04-18 11:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found