[Israel.pm] Python talk

Gaal Yahas gaal at forum2.org
Tue Dec 7 06:55:24 PST 2004


Mikhael wrote:

> And if the keys are constant arrays and not variable arrays, then you
> don't even need to join the array elements to construct the key (but
> you should be aware that Perl converts arrayref to string here):
>
>    $time = [ 100, 200 ];
>    $CAA->{$time} = { label => 'somewhere', population => 12, time => $time };

I forgot to mention that this approach, apart from potentially being
dangerous due to the ref-reuse prolem, has the obvious limitation that
applicatively equivalent keys will not match elements. I *must* have
$time to restore the value. I will be disappointed if I do

    $time2 = [ 100, 200 ];
	return $CAA->{$time2}; #undef

What I typically want for object keys is that they associate to the same
element if they pass (in Javaesque parlance) an isEqual test.

-- 
Gaal Yahas <gaal at forum2.org>
http://gaal.livejournal.com/



More information about the Perl mailing list