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

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

by Aristotle (Chancellor)
on Oct 09, 2001 at 11:14 UTC ( [id://117661]=note: print w/replies, xml ) Need Help??


in reply to Is it better to return a hash of hashes or a reference to a hash of hashes?

Another criterion to use is whether you are returning "final" or "intermittent" data: that is to say, if you just collected results in your subroutine (say, a DBI query), then returning a reference is probably the best idea most of the time. If, however, the data is a persistent part of an object, it is probably unwise to return a reference for several reasons. For one, you are giving your caller full access to the data; for another, some child class may choose to store data differently, so returning a hash reference is no longer a "natural" way to go about the query.

  • Comment on Re: 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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://117661]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (6)
As of 2024-04-23 20:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found