develooper Front page | perl.perl5.porters | Postings from October 2008

Why are the file test operators in perlfunc?

Michael G Schwern
October 30, 2008 19:48
Why are the file test operators in perlfunc?
Message ID:
This came up on #perl recently, why are the filetest operators in perlfunc?
They sure look like unary operators to me.  I wouldn't think to look for them
amongst the functions.

There's only one mention of them in perlop, and that's this.

       Regarding precedence, the filetest operators, like "-f", "-M", etc. are
       treated like named unary operators, but they don't follow this func-
       tional parenthesis rule.  That means, for example, that
       "-f($file).".bak"" is equivalent to "-f "$file.bak"".

Even the perlfunc entry says they're ops.

       -X EXPR
       -X      A file test, where X is one of the letters listed below.  This
               unary operator takes one argument

Would anyone be opposed to their docs being moved to perlop?

Stabbing you in the face for your own good. Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About