Rodney Wise wrote:
> 
> I was reviewing my code some more and here is what I think might be
> happening.
> 
> In my code, the first thing I do is declare my variables.
> 
> Then I declare my subroutines'.
> 
> It looks like by declaring my subroutines, they are being executed. ???
> 
> example of my Subroutine declarations:
> 
> # Get the Data Number
> &get_number;
> 
> # Get Form Information
> &parse_form;
> 
> These two subroutines do not take any arguments and assign values to global
> variables... so it appears that merely "declaring" them in the beginning of
> my code is causing them to execute.  If this is the case, do I have to
> declare subroutines?

You are running the subroutines.  These are all equivalent (note that
the third example only works if the sub has been declared earlier):

&get_number;
&get_number();
get_number;
get_number();

You have to use the 'sub' keyword to declare subroutines.

sub get_number;

perldoc -f sub


However you usually only have to pre-declare subs if you are using
prototypes.  Please read the perlsub.pod document to find out all about
Perl's subroutines.

perldoc perlsub



John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to