I've got a perl script that attempts to simulate a ATM machine; to keep track of my checking and savings account. I've got a subroutine for each function (including menus) and when I attempt to use one function; then return to the main menu, it does the same function time and time and time again. I have to Apple-. to escape and then close it. Below is the script. On the generic same topic, a subroutine to write out each statement (function, excluding menus) and to write it to the file that will hold all info. 'Course, you all probably can find that out by reading the script. The script isn't finished, just enough for one function (I do that to make sure it works before continuing). --BEGIN SCRIPT-- $Checking = "[blocked]"; open(SRC,"Checking.txt") || die "Can't Open SRC: $!"; @Account = <SRC>; close(SRC); &MainMenu; sub MainMenu { $MainMenu = ""; print "Main Menu\n"; print "\n"; print "1: Check\n"; print "2: Debit Card\n"; print "3: ATM Withdrawl\n"; print "4: Deposit\n"; print "5: Quit System\n"; print "\n"; print "Selection Please: "; chop($MainMenu = <STDIN>); if ($MainMenu = "1") { &CheckMenu; } elsif ($MainMenu = "2") { &DebitCardMenu; } elsif ($MainMenu = "3") { &ATMWithdrawlMenu; } elsif ($MainMenu = "4") { &DepositMenu; } elsif ($MainMenu = "5") { die "Terminating the system."; } else { print "Invalid option; try again.\n"; &MainMenu; } } sub CheckMenu { $CheckMenu = ""; print "Check Menu\n"; print "\n"; print "0: Main Menu\n"; print "1: Normal Check\n"; print "2: Void Check\n"; print "\n"; print "Selection Please: "; chop($CheckMenu = <STDIN>); if ($CheckMenu = "0") { &MainMenu; } elsif ($CheckMenu = "1") { &NormalCheckMenu; } elsif ($CheckMenu = "2") { &VoidCheckMenu; } } sub NormalCheckMenu { print "Check Number: "; chop($Number = <STDIN>); print "Check Payable To: "; chop($PayableTo = <STDIN>); print "Check Amount: \$"; chop($Amount = <STDIN>); $Number . ":" . $PayableTo . ":" . $Amount = push(@Account); &WriteOut(@Account); &CheckMenu; } sub WriteOut { open(DST,">Checking.txt") || die "Can't Open DST: $!"; foreach $Account (@Account) { print DST $Account; } close(DST); } --END SCRIPT-- -------------------------------------------------------------------------------- "If the opposite of 'pro' is 'con' ... does that mean the opposite of 'progress' is 'congress'??" -- Unknown -------------------------------------------------------------------------------- ***** Want to unsubscribe from this list? ***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch