![]() |
|
Problems? Is your data what you think it is? | |
PerlMonks |
comment on |
( #3333=superdoc: print w/replies, xml ) | Need Help?? |
I am continually working on a set of modules for a system I am planning to use in the (hopefully) near future. I have come across something new that I have never given much thought to. This is not a problem I have come across, but more of a question of style and perhaps preference. In these modules, I have several subroutines that give a hash as a return value. My question to you wise and wonderful monks is whether I should return a hash or a hash reference.
To explain perfectly well, this is an example of one of my subroutines:
The first method of returning the hash (return %input;), would be handled as such:
The second method of returning the has (return \%input;), would be handled as such: My guess is that this is probably a completely personal preference rather than style, but I might be wrong. If it is personal preference, I'd like to know which method other perl users prefer and perhaps any reason(s) as to why. :) In reply to Subroutines: Returning a hash vs. hash reference by mt2k
|
|