Solved

reference

Posted on 2000-05-17
5
150 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 10 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 84

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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

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…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
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…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

744 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now