Luke Palmer writes: > Autrijus Tang writes: > > Just a quick question: Is Hash keys still Strings, or can they be > > arbitary values? > > They can be declared to be arbitrary: > > my %hash is shape(Any); > > > > If the latter, can Int 2, Num 2.0 and Str "2" point to different > > values? > > That's an interesting question. Some people would want them to, and > some people would definitely not want them to. I think the general > consensus is that people would not want them to be different, since in > the rest of perl, 2 and "2" are the same.
I forgot an important concretity. Hashes should compare based on the generic "equal" operator, which knows how to compare apples and apples, and oranges and oranges, and occasionally a red orange to an apple. That is: 3 equal 3 ==> true 3 equal { codeblock } ==> false 3 equal "3" ==> true Luke