<div dir="ltr">While I will always manage my life by the three great virtues, I must thank you for reminding me why I gave up slinging Perl. DWIM and all the sigils drive a man to an early grave, or at least a lot of nights debugging.<div>
<br></div><div>Sean</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sun, Feb 2, 2014 at 1:10 PM, Trevor Cordes <span dir="ltr">&lt;<a href="mailto:trevor@tecnopolis.ca" target="_blank">trevor@tecnopolis.ca</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I forgot to post what *does* work.  There are a few different<br>
ways.<br>
<br>
You can force the glob to return a list (hence no caching/iterating):<br>
<br>
if (!@{[&lt;$prefix-*&gt;]}) {<br>
<br>
That&#39;s sure ugly, but it makes sense.  [] forces the &lt;&gt; to return list<br>
and turns it into an anon array-ref.  @ then derefs.  {} is required by<br>
the parser to make sense of it all.  !@ then does its normal thing of<br>
meaning &quot;if there are zero elements in this array&quot;.<br>
<br>
You could also force it to list by assigning to an array:<br>
<br>
if (!(@a=&lt;$prefix-*&gt;)) {<br>
<br>
But I hate using temp vars when we don&#39;t need to; when the results are<br>
throwaway.<br>
<br>
Strangely, using the normal &quot;we want a list&quot; syntax of just putting ()<br>
around the expression doesn&#39;t work in this case.  I&#39;m not sure why:<br>
<br>
if (!(&lt;$prefix-*&gt;)) {  # doesn&#39;t work<br>
<br>
Also strangely, while perl has a &quot;scalar&quot; function to force a scalar<br>
(non-list) result, it doesn&#39;t have a &quot;list&quot; or &quot;array&quot; function to<br>
force a list.  The scalar docs say list isn&#39;t necessary as it&#39;s usually<br>
the default/implied or can be forced with ().  Woops, looks like I<br>
found a corner case.<br>
<br>
Ya, I could have been certain everything worked in the first place by<br>
doing opendir and iterating through the results, like one would in<br>
C, but the whole purpose of using perl is to do as much as possible in<br>
as few characters and lines.  Laziness is the #1 programmer virtue,<br>
according to L.Wall and R.Schwarz.<br>
<div class="HOEnZb"><div class="h5">_______________________________________________<br>
Roundtable mailing list<br>
<a href="mailto:Roundtable@muug.mb.ca">Roundtable@muug.mb.ca</a><br>
<a href="http://www.muug.mb.ca/mailman/listinfo/roundtable" target="_blank">http://www.muug.mb.ca/mailman/listinfo/roundtable</a><br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br>Sean Walberg &lt;<a href="mailto:sean@ertw.com" target="_blank">sean@ertw.com</a>&gt;    <a href="http://ertw.com/" target="_blank">http://ertw.com/</a>
</div>