Lost Password?

Go Back   CodeCall Programming Forum > Software Development > General Programming

General Programming Non language specific, Assembly, Linux/Unix, Mac and anything not covered in other topics. Talk about Programming Theory here.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 05-12-2008, 05:38 PM
suicidal pencil suicidal pencil is offline
Newbie
 
Join Date: May 2008
Posts: 22
Last Blog:
being lazy sucks.
Rep Power: 1
suicidal pencil is on a distinguished road
Default loop problem

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"
}
}
.
.
.
.
.
__________________
Programming is an art form. Everyone can program, but few can do it right.

Last edited by suicidal pencil; 05-13-2008 at 09:54 AM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
  #2 (permalink)  
Old 05-13-2008, 07:32 PM
suicidal pencil suicidal pencil is offline
Newbie
 
Join Date: May 2008
Posts: 22
Last Blog:
being lazy sucks.
Rep Power: 1
suicidal pencil is on a distinguished road
Default Re: loop problem

whoops! I found my problem. When the program runs through the while loop, there is nothing telling it what '$input' is.

Scope will be my downfall. Feel free to lock, or delete this thread.
__________________
Programming is an art form. Everyone can program, but few can do it right.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Assembly Problem maple23 General Programming 9 04-27-2008 05:59 AM
Peculiar UI Problem Needs Tackling adriyel C# Programming 2 04-06-2008 07:46 AM
Problem read pwd protected Access2K dbase - CR9 & VB6 mrbar Visual Basic Programming 2 03-10-2008 04:50 AM
How to tackle a programming problem? TcM General Programming 10 01-07-2008 11:29 AM
Javaa:Tutorial - The Loop John Java Tutorials 0 12-09-2006 10:01 AM


All times are GMT -5. The time now is 10:32 PM.

Contest Stats

John ........ 87.50000
dargueta ........ 75.00000
Xav ........ 50.00000
MeTh0Dz ........ 20.00000
gaylo565 ........ 18.00000
Johnnyboy ........ 3.00000

Contest Rules

Ads