Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

reference

Posted on 2000-05-17
5
Medium Priority
?
170 Views
Last Modified: 2010-03-05
when should i pass by reference?
($r, @d) = DBQuery(\%dbinfo, $sql);

what is the advantage of it?
0
Comment
Question by:mwhuen
5 Comments
 
LVL 12

Expert Comment

by:geotiger
ID: 2817969
Passing a reference is just passing a point, not the whole array or object. It is quicker, cheaper (using less memory), and safer (you do not need to keep two or more copies of the same data).
0
 
LVL 16

Accepted Solution

by:
maneshr earned 40 total points
ID: 2817975
foll is a general explanation of when references are very useful.

A Perl reference is a fundamental data type that "points" to another piece of data or code. A reference knows the location of
the information and what type of data is stored there.

A reference is a scalar and can be used anywhere a scalar can be used.

References are absolutely essential for creating complex data structures.

When you pass more than one array or hash to a subroutine, Perl merges all of them into the @_ array available within the
subroutine. The only way to avoid this merger is to pass references to the input arrays or hashes.
0
 
LVL 85

Expert Comment

by:ozo
ID: 2819985
perldoc perlref
0
 
LVL 16

Expert Comment

by:maneshr
ID: 2837273
did you get the answer you were looking for?

let us know.
0
 

Author Comment

by:mwhuen
ID: 2853955
Comment accepted as answer
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

On Microsoft Windows, if  when you click or type the name of a .pl file, you get an error "is not recognized as an internal or external command, operable program or batch file", then this means you do not have the .pl file extension associated with …
Email validation in proper way is  very important validation required in any web pages. This code is self explainable except that Regular Expression which I used for pattern matching. I originally published as a thread on my website : http://www…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Six Sigma Control Plans

877 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question