I'm working on a clone method for an object (which makes a deep copy of the data structure and all other data structures 'contained' by it). I'm trying to create a new reference that refers to the same thing an existing reference points to, but is actually a separate reference, so that you get two separately-valued references pointing to the same underlying value.
It's not going as planned. Here's the code which I expected to work, but doesn't. I'm expecting \$$orig to result in a new reference, but instead it's reusing the original reference that I started with. So: $s = "some string"; $orig = \$s; $new = \$$orig; print "orig:$orig, new:$new\n"; Results in these values: orig:SCALAR(0x17753dc), new:SCALAR(0x17753dc) Is there a way to force it to create a new reference to a scalar (in the same way that [] and {}, when used as anon ref constructors, create new references), such that new != orig? And what is the underlying property of Perl that makes it give you the same hex value for the reference? TIA and Merry Christmas __________________________________________________________________ New! Unlimited Access from the Netscape Internet Service. Beta test the new Netscape Internet Service for only $1.00 per month until 3/1/04. Sign up today at http://isp.netscape.com/register Act now to get a personalized email address! Netscape. Just the Net You Need. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>