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

Why are the file test operators in perlfunc?

From:
Michael G Schwern
Date:
October 30, 2008 19:48
Subject:
Why are the file test operators in perlfunc?
Message ID:
490A71F4.9090207@pobox.com
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 FILEHANDLE
       -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.




nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About