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 }