in reply to really easy ? but want nice succinct code

Since I assume you don't have two databases with the same name, making them hash keys makes the test much easier.

#! /usr/bin/perl use strict ; use warnings ; $|++ ; my $DB = 0 ; my %DB_list = map { $_ => 1 } qw( DB1 DB2 ) ; until ( $DB_list{ $DB } ) { print "Select a database: " ; chomp( $DB = <STDIN> ) ; $DB = uc $DB ; if ( $DB eq 'Q' ) { print "Quitting...\n" and exit } } print "You chose $DB.\n" ; __END__

_______________
DamnDirtyApe
Those who know that they are profound strive for clarity. Those who
would like to seem profound to the crowd strive for obscurity.
            --Friedrich Nietzsche