Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Relative Merits of References

by Hue-Bond (Priest)
on May 11, 2006 at 13:51 UTC ( [id://548706]=note: print w/replies, xml ) Need Help??


in reply to Relative Merits of References

References are useful to pass data to functions. Using references, you pass a single scalar to the function, so perl doesn't have to copy the entire thing. Update: And they are also useful to create complex data structures. A hash of hashes is really a hash of references to hashes.

--
David Serrano

Replies are listed 'Best First'.
Re^2: Relative Merits of References
by blazar (Canon) on May 11, 2006 at 14:29 UTC

    Indeed references are just great! OTOH I have also seen very bad examples of programs abusing references in every place. I remeber this guy who kept passing stuff around referencing and dereferencing all the time, and in fact at one point he got stuck! Had he used @arrays and %hashes in the first place, is code would have been much KISSer.

Re^2: Relative Merits of References
by pbeckingham (Parson) on May 11, 2006 at 14:54 UTC

    Thanks David

    Understood, when passing by reference is needed, having a reference around is handy, but then creating one using

    \%h
    is not exactly complicated. I'm wondering if there are any reasons to choose one over the other - this example doesn't seem to qualify.



    pbeckingham - typist, perishable vertebrate.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://548706]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (7)
As of 2024-04-19 20:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found