Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options

Re: Setting a variable equal to a reference

by ikegami (Pope)
on Jul 31, 2013 at 02:03 UTC ( #1047154=note: print w/replies, xml ) Need Help??

in reply to Setting a variable equal to a reference

delete $foo->{by_id}{0} deletes an element of the hash %{ $foo->{by_id} }.

The value of that element is a ref. That ref is not referenced by anything else, so it will be freed.

The referenced hash is is referenced by something else (the ref in $foo->{by_name}{bob}), so it won't be freed.


Nothing touches the hash %{ $foo->{by_name} }.

Nothing touches the ref in $foo->{by_name}{bob} (a copy of the ref that was in $foo->{by_id}{0}).

The hash referenced by $foo->{by_name}{bob} is not freed.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1047154]
[Lady_Aleena]: You're welcome marioroy. There are a whole lot of linking shortcuts.
[marioroy]: Thank you Lady_Aleena. I've bookmarked the page.
[1nickt]: folks, would you say that 1.0 is an integer ?
[Lady_Aleena]: 1nickt, I wouldn't, but I'm not normal.
LanX aggrees, LA isn't normal ;-P
[Lady_Aleena]: LanX, thanks bunches.
[Lady_Aleena]: Rigth now I'm ranting in my head about an old subject.

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (10)
As of 2017-05-24 18:27 GMT
Find Nodes?
    Voting Booth?