develooper Front page | perl.perl5.porters | Postings from September 2002

Re: Collections

Thread Previous | Thread Next
From:
Arthur Bergman
Date:
September 29, 2002 14:51
Subject:
Re: Collections
Message ID:
93629C99-D3F5-11D6-82FB-003065D64CBE@contiller.se

On söndag, sep 29, 2002, at 23:45 Europe/Stockholm, Nicholas Clark 
wrote:

>
> Based on an idea H Merijn Brand told me, try using try using the string
> generated by (pack 'I', $obj) as your hash key, and see if that helps.
>
> (The I in pack will cause the $obj reference to be read in a numeric 
> context,
> which will give the address of the object (rather than the 
> stringification
> of the address of the object). Also unique, but faster.
> The pack itself will convert that to a string representation which is 
> both
> shorter, and should hash more uniformly, than either the stringified
> reference, or the numeric value of the reference)
>
> Nicholas Clark
> -- 
>

And then you could even use Devel::Pointer to turn it back into an 
object :-)

Arthur


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About