in reply to Split does not behave like a subroutine
The term "list value" was confusing me, in such cases I recommend looking into perlglossary#LIST ff.
NB: Perlglossary is from an appendix from the Camel (IIRC), while the perldocs were written by different authors.
A syntactic construct representing a comma- separated list of expressions, evaluated to produce a list value. Each expression in a LIST is evaluated in list context and interpolated into the list value.
An ordered set of scalar values.
The situation in which an expression is expected by its surroundings (the code calling it) to return a list of values rather than a single value. Functions that want a LIST of arguments tell those arguments that they should produce a list value. See also context.
An operator that does something with a list of values, such as join or grep. Usually used for named built-in operators (such as print, unlink, and system) that do not require parentheses around their argument list.
An unnamed list of temporary scalar values that may be passed around within a program from any list-generating function to any function or construct that provides a list context.
I think one source of confusion (besides @arrays) is the syntactic meaning of parentheses ...(...)... in different constructs.
is an empty list
expects a LIST of arguments to a sub bareword °
picks elements from a list
is a list assignment enforcing list context on the RHS updated
... those constructs impose a list context inside
But ...
those parens are just for precedence
please see Examples for "LIST", "list context", "list value", "list assigment", "list operator"
Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery
°) well modulo sub-prototype
|
---|