I've been toying with making a calculator in PERL, and I finally finished it!
when I go to run it, it runs perfectly...until it hits the part in the code where it's supposed to go into a loop. When it does, it
should wait for me to type something. Instead, it loops the 'else' statement infinitely.
Can anyone help?
Code:
.
.
.
#INPUT
$input = <STDIN>;
print "*\n";
#the beginning portion of the program.
while ($while_lobby == 1){
print "Welcome, to the Command-Line Calculator Version two-point-oh.\n*\n";
sleep(3);
print "For file history, type in \'file history\'.\n*\n";
sleep(1);
print "If this is your first time using this, type in \'help\'\n";
sleep(1);
print "To start your hardcore calculating, type in \'go\'\n*\n";
$while_lobby = 0;
$while_wait = 1;
}
#This while loop patiently waits for you to make a decision.
while ($while_wait == 1){
if ($input eq "help"){
print "$help_block\n";
}
elsif ($input eq "file history"){
print "$file_history\n";
}
elsif ($input eq "go"){
print "going into the calculator. Remember the equal sign at the end!\n";
$while_wait = 0;
$while_calculator = 1;
}
else {
print "Unrecognized command. Type \'help\'\n"
}
}
.
.
.
.
.