@rocks has asked for the wisdom of the Perl Monks concerning the following question:
Hi Perl Monks,
I just wanted to get something straight that I read in Learning Perl 3rd Edition. I am on Chapter 4 Subroutines. I am wondering if after you define a subroutine with the & character that I can just say sub then the subroutine. For example can I....
and then after I have defined that subroutine can I run it later in the script by just saying....&max { if ($a=$b){ print "hey!, that's the same thing./n"; } else { print "those aren't the same things.\n";
sub max that is my question. Can I? Also, if you have any extra time please tell me what it mean when you can "omit the ampersand" when using subroutines. Is it like I said when you say "Sub max", or something totally different?
-@rocks
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Defining Subroutines
by Zaxo (Archbishop) on Oct 24, 2002 at 03:02 UTC | |
by rir (Vicar) on Oct 24, 2002 at 04:11 UTC | |
by @rocks (Scribe) on Oct 24, 2002 at 04:40 UTC | |
Re: Defining Subroutines
by janx (Monk) on Oct 24, 2002 at 06:58 UTC |
Back to
Seekers of Perl Wisdom