X-Git-Url: https://perl5.git.perl.org/perl5.git/blobdiff_plain/29b04a70d1bf9a10be65363f3f8d6dae44cfa6fc..b3893bfa90e8810497e2f81458a5a46db611cadf:/pod/perlfunc.pod diff --git a/pod/perlfunc.pod b/pod/perlfunc.pod index b5fb4f1..98cba47 100644 --- a/pod/perlfunc.pod +++ b/pod/perlfunc.pod @@ -14,11 +14,12 @@ take more than one argument. Thus, a comma terminates the argument of a unary operator, but merely separates the arguments of a list operator. A unary operator generally provides scalar context to its argument, while a list operator may provide either scalar or list -contexts for its arguments. If it does both, scalar arguments +contexts for its arguments. If it does both, scalar arguments come first and list argument follow, and there can only ever -be one such list argument. For instance, splice() has three scalar -arguments followed by a list, whereas gethostbyname() has four scalar -arguments. +be one such list argument. For instance, +L|/splice ARRAY,OFFSET,LENGTH,LIST> has three scalar arguments +followed by a list, whereas L|/gethostbyname NAME> has +four scalar arguments. In the syntax descriptions that follow, list operators that expect a list (and provide list context for elements of the list) are shown @@ -30,7 +31,7 @@ Commas should separate literal elements of the LIST. Any function in the list below may be used either with or without parentheses around its arguments. (The syntax descriptions omit the -parentheses.) If you use parentheses, the simple but occasionally +parentheses.) If you use parentheses, the simple but occasionally surprising rule is this: It I like a function, therefore it I a function, and precedence doesn't matter. Otherwise it's a list operator or unary operator, and precedence does matter. Whitespace @@ -43,16 +44,16 @@ you need to be careful: print +(1+2)+4; # Prints 7. print ((1+2)+4); # Prints 7. -If you run Perl with the B<-w> switch it can warn you about this. For -example, the third line above produces: +If you run Perl with the L|warnings> pragma, it can warn +you about this. For example, the third line above produces: print (...) interpreted as function at - line 1. Useless use of integer addition in void context at - line 1. A few functions take no arguments at all, and therefore work as neither -unary nor list operators. These include such functions as C