From: Rafael Garcia-Suarez Date: Thu, 9 Oct 2003 11:06:15 +0000 (+0000) Subject: Document the behaviour of filetest operators regarding parentheses. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=568e6d8bd7657b48163f7ab2d0c13229c0263323;p=p5sagit%2Fp5-mst-13.2.git Document the behaviour of filetest operators regarding parentheses. This fixes bug #24127 (by documenting it as a feature.) p4raw-id: //depot/perl@21431 --- diff --git a/pod/perlop.pod b/pod/perlop.pod index a50dee9..081774e 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. +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