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__
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
In reply to Re: really easy ? but want nice succinct code
by DamnDirtyApe
in thread really easy ? but want nice succinct code
by bcole23
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |