in reply to Previously unseen error in connection with -X functions
Now, I don't even know if this is a proper SoPW since I understand that, to put it simply, "something strange happens with these strangely named functions, even if the docs say that they apart that detail they're not different from any other unary operator..."Since you cannot override operators (although you can overload certain operations - but said overload magic hangs off the operand, not the operator itself), it isn't surprising you cannot override -e. Note also that the error message you get you also get if you replace '-e' with '+', 'cmp', 'feeble' or any other non-function.
Here's another way to see -e isn't a function:
It wouldn't be a syntax error if -e was a function.perl -wce '&-e' Bareword found where operator expected at -e line 1, near "&-e" (Missing operator before e?) syntax error at -e line 1, next token ??? -e had compilation errors.
Note also that perlfunc says they are operators:
-X FILEHANDLE -X EXPR -X DIRHANDLE -X A file test, where X is one of the letters listed below. This unary operator takes one argument, either a filename, a filehandle, or a dirhandle, and tests the associated file to see if something is true about it.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Previously unseen error in connection with -X functions
by blazar (Canon) on Oct 31, 2008 at 13:44 UTC | |
by JavaFan (Canon) on Oct 31, 2008 at 14:30 UTC |
In Section
Seekers of Perl Wisdom