From: Jonas Liljegren [mailto:[EMAIL PROTECTED]]
> 
> Does any other RFC give the equivalent to an 'in' operator?
> 
> I have a couple of times noticed that beginners in programming want to
> write if( $a eq ($b or $c or $d)){...} and expects it to mean
> if( $a eq $b or $a eq $c or $a eq $d ){...}.
> 
> I think it's a natural human reaction to not be repetative. An 'in'
> operator will help here. It could be something like this:
> 
>     $a in @b; # Has @b any element exactly the same as $a
>     $a == in @b; # Is any element numericaly the same as $a
>     $a eq in @b;
>     $a > in @b;  # Is $a bigger than any element in @b?
>     $a not in @b; # Yes. Make 'not' context dependent modifier for in.

      grep { ref($a) eq ref($b) } @b)  # Same type?
      grep { $a == $_ } @b)
      grep { $a eq $_ } @b)
      grep { $a > $_ } @b)
      (grep { $a != $_ } @b) == @b)

Garrett

Reply via email to