in reply to really easy ? but want nice succinct code

#! perl -w my @dbs = <DATA>; my $db= "\n"; print "Select DB from:\n @dbs or Q to quit:" and $db = uc(<>) while( $db eq "\n" || "@dbs\nQ\n" !~ m/$db/s); chomp $db; $db eq 'Q' and die "Quiting...\n"; print "\n$db selected\n"; __DATA__ DB1 DB2

Looks like this is use:

C:\test>190748 Select DB from: DB1 DB2 or Q to quit: Select DB from: DB1 DB2 or Q to quit:fred Select DB from: DB1 DB2 or Q to quit:db2 DB2 selected C:\test>190748 Select DB from: DB1 DB2 or Q to quit:q Quiting... C:\test>

What's this about a "crooked mitre"? I'm good at woodwork!

Replies are listed 'Best First'.
Re: Re: really easy ? but want nice succinct code
by bcole23 (Scribe) on Aug 19, 2002 at 20:42 UTC
    That is a thing of beauty. Thank you all for your replies. I've learned quite a bit from this. Brandon