my @colors = qw(red green blue); enum 'colors', \@colors; has scores => ( is => 'rw', isa => 'HashRef', default => sub { use Hash::Util 'lock_keys'; my %hash; lock_keys %hash, @colors; return \%hash; } );