On Tue, Jul 3, 2012 at 1:59 AM, Ed Avis <eda@waniasset.com> wrote: > The current convention is that punctuation operators like == != < are > numeric, while alphabetic ones like eq ne lt do string comparisons. > An 'in' operator doing string comparison follows that convention. > While you could also have an equivalent in== operator, in my > experience that operation is much less common than the string version. > In an earlier message I talked about "in_eq" and "in_==" and so forth, but I didn't intend those to be the actual names in use. I agree that the convention is that numeric versions of operators use punctuation, and I had imagined that there would be one created for "in_==", although I don't know which punctuation characters could be used without causing conflicts in the parser or what symbols might best signify in_== (although, of course, in Unicode there's an "is-an-element" symbol, ∈ ). > As in Python, 'in' could work for both arrays and hashes: > > $x in @array > > $x in %hash # same as exists $hash{$x} > Is that what it does in Python? I thought it would be more useful applied to the values of a hash, since (just as with arrays) we have no easy way of doing that now with hash values, and the values of an array are analogous to the values, not the keys, of a hash. And we already have exists $hash{$x}. -- Aaron Priven, aaron@priven.comThread Previous | Thread Next