<?xml version="1.0" encoding="windows-1252"?>
<node id="216613" title="Re(4): My coding guidelines" created="2002-11-29 18:38:54" updated="2005-06-22 14:36:32">
<type id="11">
note</type>
<author id="9547">
mojotoad</author>
<data>
<field name="doctext">
&lt;blockquote&gt;&lt;em&gt;If not, why not? What do you use instead?
I find not is usually the cleanest and most readable operator for all sorts of tests.&lt;/em&gt;&lt;/blockquote&gt;
&lt;p&gt;
It's just a matter of taste. I'm not &lt;em&gt;against&lt;/em&gt; using &lt;code&gt;not&lt;/code&gt;, I just don't happen to prefer it.
&lt;p&gt;
You give the following example:
&lt;p&gt;
&lt;code&gt;
print "$pattern not found in $file\n" if not $found;
&lt;/code&gt;
&lt;p&gt;
In this case I would use unless:
&lt;p&gt;
&lt;code&gt;
print "$pattern not found in $file\n" unless $found;
&lt;/code&gt;
&lt;p&gt;
As for &lt;code&gt;if (not -r $file) {...}&lt;/code&gt;, I typically use the bang operator (!) rather than &lt;code&gt;not&lt;/code&gt; -- just a matter of preference, probably due to my C influences.
&lt;p&gt;
Matt
</field>
<field name="root_node">
215675</field>
<field name="parent_node">
216341</field>
</data>
</node>
