<?xml version="1.0" encoding="windows-1252"?>
<node id="394269" title="A &quot;but&quot; operator." created="2004-09-27 13:58:47" updated="2005-08-12 13:26:06">
<type id="120">
perlmeditation</type>
<author id="333489">
muba</author>
<data>
<field name="doctext">
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 "&amp;&amp;" and "||")) and I thought I would like a "but" operator. I told that to my girlfriend.&lt;BR&gt;&lt;BR&gt;

Well, she's no programmer but she does understand a programmer's way of thinking and she has some understanding of boolean logic.&lt;BR&gt;&lt;BR&gt;

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) &lt;CODE&gt; not EXPR-THIS but EXPR-THAT &lt;/CODE&gt; or &lt;CODE&gt; EXPR-THAT but not EXPR-THIS &lt;/CODE&gt; and in that case, you could as well just say &lt;CODE&gt; EXPR-THAT &lt;/CODE&gt;."&lt;BR&gt;&lt;BR&gt;

Hmm, I thought. You are pretty right, actually. Then I discoverd that the importing mechanism does have something like a "but" operator (&lt;CODE&gt;use MyModule qw(:standard !somesub)&lt;/CODE&gt;). But (&amp;lt;-- 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".&lt;BR&gt;&lt;BR&gt;

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.&lt;BR&gt;&lt;BR&gt;

Whatever.

&lt;!-- Node text goes above. Div tags should contain sig only --&gt;
&lt;div class="pmsig"&gt;&lt;div class="pmsig-333489"&gt;
&lt;BR&gt;&lt;BR&gt;&lt;BR&gt;&lt;BR&gt;
&lt;CODE&gt;"2b"||!"2b";$$_="the question"&lt;/CODE&gt;&lt;BR&gt;
Besides that, my code is untested unless stated otherwise.&lt;BR&gt;
One more: please review the [id://383015|article about regular expressions (do's and don'ts) I'm working on].
&lt;/div&gt;&lt;/div&gt;</field>
</data>
</node>
