Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Answer: Is it better to return a hash of hashes or a reference to a hash of hashes?

( #149488=categorized answer: print w/ replies, xml ) Need Help??

Q&A > subroutines > Is it better to return a hash of hashes or a reference to a hash of hashes? contributed by Russ

In the final analysis, it is up to you. One of the strengths of Perl is how it allows the programmer to work efficiently. The computer usually works efficiently, too, but the programmer's efficiency comes first.

So, if you decide it is better/easier/simpler to return an "expensive" data structure (rather than forcing your caller to dereference it later), then go right ahead! Unless you are doing something really "out there" (and I could give you some examples I have tried and discarded ;-) Perl will take good care of you.

Comment on Answer: Is it better to return a hash of hashes or a reference to a hash of hashes?
Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (9)
As of 2014-07-11 02:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (217 votes), past polls