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

Re: [MacPerl] Subroutines



On Thu, 30 May 1996, Tim Judd wrote:

> I need some help with subroutines.  I can make them, compile them, but
> when I want my program to call them, nothing will actually make the
> subroutines work.  Can I get some help here?
> 
> Sample snippet from code:
> -----
> if ($UserPassword eq $Data[1]) {
>   print "Password accepted.\n";
>   MainMenu
>   } 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]
>   }
> -----
> 


I would go ahead and use both the '&' before the call and the
semi-colon afterwards.  Your call would look like this:

&MainMenu;

And if you are really keen (hehe) do this:

&MainMenu();

Hasta Luego,
Anthony Eden
Hurricane Online Editor