babel17 has asked for the wisdom of the Perl Monks concerning the following question:
If I set a variable equal to a reference, is the reference count of the item pointed to by the reference incremented?
I am going to show an example that's slightly more complicated than necessary cause it better represents what I'm trying to accomplish.
my $foo = { by_id => { 0 => { id => 0, name => "bob", other => "Nothing to see here", }, }, }; $foo->{by_name}{bob} = $foo->{by_id}{0};
If I delete $foo->{by_id}{0};, is $foo->{by_name}{bob} still valid?
It's quite easy to simply test this, but I'm more interested in the discussion I hope to provoke in order to better understand perl's internal plumbing.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Setting a variable equal to a reference
by ikegami (Patriarch) on Jul 31, 2013 at 02:03 UTC | |
|
Re: Setting a variable equal to a reference
by zork42 (Monk) on Jul 31, 2013 at 04:34 UTC | |
|
Re: Setting a variable equal to a reference (tryitstosee)
by Anonymous Monk on Jul 30, 2013 at 22:39 UTC |