From: [EMAIL PROTECTED] > If I have: > > $a = [ 1, 2, 3 ]; > $b = [ 1, 2, 3 ]; > > %foo{$a} = 'A'; > %foo{$b} = 'B'; > > Then I want C< (%foo{$a} == 'A') && %foo{$b} == 'B' > to be true.
Maybe this a case of "And Now For Something Completely Similar". This looks like something we already have in Perl 5, so the language wouldn't need to be changed in this regard. In Perl 5 the string ID's of the objects, which are guaranteed globally unique during their lifetime, can be used as hash keys. So for the code above, your desire for C< (%foo{$a} == 'A') && %foo{$b} == 'B' > would be met. Of course, you can't pull the objects themselves back out of the C<keys> array, but FWIW there's a module on CPAN that gives you that ability, so even that requirement is sorta met in Perl 5. > I want to be able to do C< $b[0] = 3 > and > still be able to lookup %foo{$b} Again, looks like you want something that's already in Perl 5. Tweak the above code to Perl5 syntax and it Does What You Expect. > But then sometimes you'd *want* hashing to be based > on the content. Hmm. Assuming $b hasn't been > modified, how about: > > %foo{*$a} = 'A'; > %foo{*$b} = 'B'; If we can make the assumption that the need to do this type of thing is so rare that we don't need a special language feature to do it, we can again look to existing Perl 5 capabilities to give you what you want: %foo{join '', @a} = 'A' > Sorry if this got a bit rambly; I'm not sure working > things out as you type is necessarily a good idea Maybe I'm doing that myself. Here's my point: the features you suggest sound great. However, all of those features are already available in Perl 5 in an only slightly more roundabout way. Ergo, I submit that the language does not need to be changed in any way to do what you suggest. -Miko -------------------------------------------------------------------- mail2web - Check your email from the web at http://mail2web.com/ .