in reply to Menu Troubles..
Your code could be greatly simplified with the use of a couple of arrays and a hash.
Try something like this. (UNTESTED)
my %hash; my @hashkey = qw(fname lname school phone position role pass); my @query = ('First Name','Last Name','The School you work at', etc... +. ); my $number = 0; while ($number < 8) { system "cls"; print "You have entered these Values for each of these fields."; print "If you wish to Fix any of the information now. Select Number +to Change:\n"; print "\t1. $query[0]: $hash{$hashkey[0]\n"; print "\t2. $query[1]: $hash{$hashkey[1]\n"; .. .. print "\t8. Done\n"; print "Type a number to Choose to fix: "; $number = <STDIN>; if ($number < 8 ) { system "cls"; while ($hash{$hashkey[$number]} eq "") { printf "\n\nPlease Enter your $query[$number]: "; $hash{$hashkey[$number]} = <STDIN>; chomp($hash{$hashkey[$number]}); } } } exit;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Menu Troubles..
by Tanktalus (Canon) on Jun 15, 2005 at 23:12 UTC | |
by Snowman11 (Novice) on Jun 24, 2005 at 16:23 UTC | |
by Tanktalus (Canon) on Jun 24, 2005 at 16:38 UTC | |
by Snowman11 (Novice) on Jun 24, 2005 at 16:49 UTC |