in reply to Re: Address of anonymous hash
in thread Address of anonymous hash
You should never use a memory-address as a “key.”
Have you heard of inside-out objects? At the base, they do exactly what just proclaimed shouldn't be done.
{ my %objs; sub new { my $obj = { ... }; my $key = 0+$obj; $data{$key} = $rec; return $key; } }
(Blessing omitted for clarity.)
I don't know to what side-effect you are referring. That numification of a reference returns its address? That's safe.
|
|---|