|P is for Practical|
A "but" operator.by muba (Priest)
|on Sep 27, 2004 at 17:58 UTC||Need Help??|
A couple of nights ago, I was thinking a little, about Perl, about programming in general, about operators (especially "and" and "or" (or their higher precedence brothers "&&" and "||")) and I thought I would like a "but" operator. I told that to my girlfriend.
Well, she's no programmer but she does understand a programmer's way of thinking and she has some understanding of boolean logic.
So I told her I would like a "but" operator. Then she said, "that wouldn't be quite usefull, because that would make you able to say (pseudocode) not EXPR-THIS but EXPR-THAT or EXPR-THAT but not EXPR-THIS and in that case, you could as well just say EXPR-THAT ."
Hmm, I thought. You are pretty right, actually. Then I discoverd that the importing mechanism does have something like a "but" operator (use MyModule qw(:standard !somesub)). But (<-- there it is) I didn't enjoy that one as much as a true "but" operator that would work a little like "and" and "or".
A long story made short: I (er... my girlfriend) concluded a "but" operator would be useless and I think it's a pity. I still like the abstract idea of having such a thing.
Besides that, my code is untested unless stated otherwise.
One more: please review the article about regular expressions (do's and don'ts) I'm working on.