[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] Subroutines



Hello !

Tim Judd wrote:
> 
> -----
> if ($UserPassword eq $Data[1]) {
>   print "Password accepted.\n";
>   MainMenu     ###  <---- problem here ----
>   } else {
>   print "Password invalid.\n";
>   die "Invalid password - open program again for another try.\n";
>   }
> 
> sub MainMenu {
>   print "A.) Enter another deduction,\n";
>   print "B.) Review past 5 deductions,\n";
>   print "C.) Review past 2 deposits,\n";
>   ...  [not continued]
>   }
> -----

 Change the marked line to

   &MainMenu

 You may leave out the '&' if you define your subroutine _before_
 calling it in your code; in your case the '&' is required.


 Hope this helps, Eike

=====================================================================
 Eike Grote, Theoretical Physics IV, University of Bayreuth, Germany
            email : eike.grote@theo.phy.uni-bayreuth.de
         URL : http://btrzxa.fddi.uni-bayreuth.de/~btpa25/
=====================================================================