use Object::Enum qw(Enum); my $color = Enum([ qw(red yellow green) ]); # ... later if ($color->is_red) { # it can't be yellow or green WWW: http://search.cpan.org/dist/Object-Enum/