<?xml version="1.0" encoding="windows-1252"?>
<node id="1016830" title="Re^3: Using grep and glob to find directories containing file" created="2013-02-03 10:35:23" updated="2013-02-03 10:35:23">
<type id="11">
note</type>
<author id="171588">
BrowserUk</author>
<data>
<field name="doctext">

&lt;blockquote&gt;&lt;i&gt;
Since the first expression glob("$_/f*") is only true for 'dir1', it should only return that element of the directory list (even though glob returns 3 files in that directory). 
&lt;/i&gt;&lt;/blockquote&gt;

&lt;p&gt;You are missing the fact that [grep] puts the [glob] in a scalar context, and that makes it act as an iterator:

&lt;blockquote&gt;&lt;i&gt;
In scalar context, glob iterates through such filename expansions, returning undef when the list is exhausted. 
&lt;/i&gt;&lt;/blockquote&gt;




&lt;div class="pmsig"&gt;&lt;div class="pmsig-171588"&gt;
&lt;hr /&gt;
&lt;font size=1 &gt;
&lt;div&gt;With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'&lt;/div&gt;
&lt;div&gt;Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.&lt;/div&gt;
&lt;div&gt;"Science is about questioning the status quo. Questioning authority". &lt;/div&gt;
&lt;div&gt;In the absence of evidence, opinion is indistinguishable from prejudice.
&lt;/div&gt;
&lt;/font&gt;

&lt;/div&gt;&lt;/div&gt;</field>
<field name="root_node">
1016826</field>
<field name="parent_node">
1016828</field>
</data>
</node>
