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 :)
edit:
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 :).
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 :)
edit:
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 :).
Back to
Seekers of Perl Wisdom