|Perl: the Markov chain saw|
VB-ish behaviour byVar or byRef of objects in Perlby jbrugger (Parson)
|on Dec 11, 2007 at 14:39 UTC||Need Help??|
jbrugger has asked for the
wisdom of the Perl Monks concerning the following question:
Dear monks, After being away from Perl for a year, i'm back, and i seek new wisdom :)
In the .Net platform an object is stored in the heap. When passing the object 'as value' and not as a reference, the object itself isn't copied, you still get a reference to it (instead of a fresh copy).
If you want a copy (like items on the stack), you need to deep copy (clone) the object by hand.
I wonder how this is done in Perl, since i could not find any info on it.
Thanks again :)
as just stated by jkva (and the others below (thanks) ).... an object in Perl already IS a reference... So it stays a reference as it's passed :).