In addition to the above you can use a RE perlre and do:
if ( $color =~ m/^(red|green|blue)$/ ) { blah }; # a common perl idiom is: my @colors = qw( red green blue pink fuscia ); my $color_re = join '|', @colors; $color_re = qr/$color_re/; # compile RE for efficiency if ( $color =~ m/^(?:$color_re)$/ ) { blah }
Note the ?: stops capturing the color matched in the RE in $1
cheers
tachyon
s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print
In reply to Re: OR operator
by tachyon
in thread OR operator
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |