diff options
author | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2003-10-09 11:06:15 +0000 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2003-10-09 11:06:15 +0000 |
commit | 568e6d8bd7657b48163f7ab2d0c13229c0263323 (patch) | |
tree | 0a4953215910ec912ac87f005b6ead38ad620746 | |
parent | 459483364bd8ae7bd68c1206c3548757357dcc00 (diff) | |
download | perl-568e6d8bd7657b48163f7ab2d0c13229c0263323.tar.gz |
Document the behaviour of filetest operators regarding parentheses.
This fixes bug #24127 (by documenting it as a feature.)
p4raw-id: //depot/perl@21431
-rw-r--r-- | pod/perlop.pod | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/pod/perlop.pod b/pod/perlop.pod index a50dee9d3d..081774e425 100644 --- a/pod/perlop.pod +++ b/pod/perlop.pod @@ -281,8 +281,7 @@ of bits is also undefined. =head2 Named Unary Operators The various named unary operators are treated as functions with one -argument, with optional parentheses. These include the filetest -operators, like C<-f>, C<-M>, etc. See L<perlfunc>. +argument, with optional parentheses. If any list operator (print(), etc.) or any unary operator (chdir(), etc.) is followed by a left parenthesis as the next token, the operator and @@ -307,6 +306,11 @@ but, because * is higher precedence than named operators: rand (10) * 20; # (rand 10) * 20 rand +(10) * 20; # rand (10 * 20) +Regarding precedence, the filetest operators, like C<-f>, C<-M>, etc. are +treated like named unary operators, but they don't follow this functional +parenthesis rule. That means, for example, that C<-f($file).".bak"> is +equivalent to C<-f "$file.bak">. + See also L<"Terms and List Operators (Leftward)">. =head2 Relational Operators |