On Thu, Mar 20, 2008 at 11:28 AM, Joel <[EMAIL PROTECTED]> wrote:
> > > my_function "foo", "bar";
> >
> > > my_function is a list operator which has a very low precedence so the
> > > parentheses are not required.
> >
> > Sometimes, i.e. if the sub is not predeclared, they are required.
> >
>
> yes this is true, because perl doesn't know that my_function is
> actually a function call when it doesn't see it predeclared..
>
> I have another question, why are function calls without parantheses
> called list operators, is there no difference between the two?
> why isn't a function call with parantheses called a list operator too?
snip
Not all subroutines are list operators. For instance,
sub square ($) { $_[0] ** 2 }
is a named unary operator.
from perldoc perlop*
Actually, there aren't really functions in this sense, just
list operators and unary operators
behaving as functions because you put parentheses around the arguments.
* http://perldoc.perl.org/perlop.html#Terms-and-List-Operators-(Leftward)
--
Chas. Owens
wonkden.net
The most important skill a programmer can have is the ability to read.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/