From 4fb67938d761c2c60668d0aa0ff50b0f31fe2b26 Mon Sep 17 00:00:00 2001 From: Father Chrysostomos Date: Sat, 19 Feb 2011 20:25:44 -0800 Subject: [PATCH] perlfunc/-X: rearrange slightly and note llafr exemption MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit The paragraphs explaining -x -r -w and -T -B have grown over time, obscuring the bit about the syntax, so I’ve moved it up. I have also expanded it to note its exemption from the ‘looks like a function’ rule (which is currently mentioned only in perlop, if I remember correctly). --- pod/perlfunc.pod | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/pod/perlfunc.pod b/pod/perlfunc.pod index 055279a..309e577 100644 --- a/pod/perlfunc.pod +++ b/pod/perlfunc.pod @@ -349,6 +349,20 @@ Example: #... } +Note that C<-s/a/b/> does not do a negated substitution. Saying +C<-exp($foo)> still works as expected, however: only single letters +following a minus are interpreted as file tests. + +These operators are exempt from the "looks like a function rule" described +above. That is, an opening parenthesis after the operator does not affect +how much of the following code constitutes the argument. Put the opening +parentheses before the operator to separate it from code that follows (this +applies only to operators with higher precedence than unary operators, of +course): + + -s($file) + 1024 # probably wrong; same as -s($file + 1024) + (-s $file) + 1024 # correct + The interpretation of the file permission operators C<-r>, C<-R>, C<-w>, C<-W>, C<-x>, and C<-X> is by default based solely on the mode of the file and the uids and gids of the user. There may be other @@ -378,10 +392,6 @@ filehandle won't cache the results of the file tests when this pragma is in effect. Read the documentation for the C pragma for more information. -Note that C<-s/a/b/> does not do a negated substitution. Saying -C<-exp($foo)> still works as expected, however: only single letters -following a minus are interpreted as file tests. - The C<-T> and C<-B> switches work as follows. The first block or so of the file is examined for odd characters such as strange control codes or characters with the high bit set. If too many strange characters (>30%) -- 2.7.4