Hi all,
Here is a simple script that I am having a heck of a time with. I think it
will become apparent what I'm trying to do. Ask a question and validate the
answer.
&AskQuestion("Enter the hierarchical mode", my @hier = qw/inquiry smart
yes/);
sub AskQuestion {
my $prompt = shift;
my @answers = @_;
my $response;
while ( ! $response ) {
print "$prompt [@_[0]]";
$response = <STDIN>;
chomp $response;
if ( $response eq "" ) {
$response = @answers
}
if ( $response eq "?") {
$response = "";
print "Valid answers are: \n";
print "@answers\n";
}
print "\n";
my $match;
for ( my $i = 0; $i < @answers ; $i++ ){
if ( $response eq $answers ){
$match = "true";
return $response;
}
}
if ( ! $match ){ $response = "";}
}
}
I think it must be friday or something, but could someone help me clean this
up. I want something simple, and I think I have over-engineered this. Any
help is appreciated!
Thanks so much. I love this list!:)
--
Steven M. Klass
Physical Design Manager
National Semiconductor Corp
7400 W. Detroit Street
Suite 170
Chandler AZ 85226
Ph:480-753-2503
Fax:480-705-6407
[EMAIL PROTECTED]
http://www.nsc.com
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]