in reply to really easy ? but want nice succinct code

use strict; my $DB; my @DB = qw(DB1 DB2); { $DB = select_db(); redo unless grep {$_ eq $DB} (@DB,'Q'); } die if $DB eq 'Q'; sub select_db { print "Select a database: "; chomp($_ = <STDIN>); return $_; }
UPDATE:
Specified STDIN inside the angle brackets - thanks for the head's up Zaxo. I was being too succinct and forgot that even though my original code works, it tries to open any arguments one might accidentaly supply on the command line. Oops. :)

jeffa

L-LL-L--L-LL-L--L-LL-L--
-R--R-RR-R--R-RR-R--R-RR
B--B--B--B--B--B--B--B--
H---H---H---H---H---H---
(the triplet paradiddle with high-hat)