my @valid=qw(DB1 DB2); do { print "Enter a DB choice: "; $choice=; chomp $choice; die if $choice eq 'Q'; } until grep {$_ eq $choice} @valid;