in reply to mod_perl and function declrations

The difference is purely superficial, AFAIK. The sub() operator within Perl is subject to most of the same rules as the rest. That being said, parentheses are largely optional and are there for readability and grouping purposes only.

Consider these two declarations:

sub foo () { ... } sub bar { ... }

To Perl, they are broken up into the following 'chunks':


What Perl is then doing is substituting defaults for missing chunks. In the PROTOTYPE chunk, where you have a null value in the bar subroutine, essentially, you can think of it as substituting the empty list as the foo subroutine has. (Really, though, it may be doing something quite different, and likely is- I have no idea what Perl does under the covers- yet. ;)

It's just as the calls to print that you make in your code could just as easily have been written:
print ($_[0]);
instead of without the parenthesis. The interpreter is usually very good about guessing at what you really mean.

So, if you use a prototype as part of the subroutine, you'll need the parentheses to group the prototype together. Declaring a subroutine with no prototype is, essentially, the exact same thing as declaring it with an empty list, "( )", for the prototype.

Hope this helps!

--jwest

-><- -><- -><- -><- -><-
All things are Perfect
    To every last Flaw
    And bound in accord
         With Eris's Law
 - HBT; The Book of Advice, 1:7