Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

reference

Posted on 2000-05-17
5
Medium Priority
?
167 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

Many time we need to work with multiple files all together. If its windows system then we can use some GUI based editor to accomplish our task. But what if you are on putty or have only CLI(Command Line Interface) as an option to  edit your files. I…
A year or so back I was asked to have a play with MongoDB; within half an hour I had downloaded (http://www.mongodb.org/downloads),  installed and started the daemon, and had a console window open. After an hour or two of playing at the command …
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

670 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