Just a couple more thoughts on the suggestion of an 'in' operator (which others besides me have proposed). 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. As in Python, 'in' could work for both arrays and hashes: $x in @array $x in %hash # same as exists $hash{$x} With the auto-dereferencing introduced in recent perls, the RHS could be an array or hash ref. $x in $hash_ref # same as exists $hash_ref->{$x} I do not envisage the 'in' operator being part of some grand scheme which will replace all functionality provided by smartmatch, but just propose it as a simple operator which is useful in its own right and, in my opinion, can make for clearer and more concise code. -- Ed Avis <eda@waniasset.com>Thread Previous | Thread Next