On Apr 10, Nikola Janceski said:
>What does the (left/right/nonassoc) mean?
They mean "left-associative", "right-associative", or "non-associative".
They govern what DIRECTION things are evaluated in.
$x + $y + $z
evaluates LEFT to right -- the ($x + $y) is done first, not the ($y + $z).
On the contrary,
$x ** $y ** $z
evaluates RIGHT to left -- the ($y ** $z) is done first, not the ($x **
$y).
Non-associative things like ++ and -- have no specific binding, partly
because they can't be "chained". That means you can't say
$x < $y < $z
>What are examples of 'terms and list operators (leftward)'?
>What are examples of 'named unary operators'?
>What are examples of 'list operators (rightward)'?
(From perlfunc.pod)
The functions in this section can serve as terms in an
expression. They fall into two major categories: list
operators and named unary operators. These differ in their
precedence relationship with a following comma. (See the
precedence table in the perlop manpage.) List operators
take more than one argument, while unary operators can never
take more than one argument. Thus, a comma terminates the
argument of a unary operator, but merely separates the
arguments of a list operator.
Those are the definitions. Now for examples. chomp(), print(),
push()... these are all LIST operators. sleep(), time(),
localtime()... those are UNARY operators. I can't think of any
right-associative list-ops off the top of my head... the ones I think of I
assume are all left-associative.
--
Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/
RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/
** Look for "Regular Expressions in Perl" published by Manning, in 2002 **
<stu> what does y/// stand for? <tenderpuss> why, yansliterate of course.
[ I'm looking for programming work. If you like my work, let me know. ]
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]