Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re^3: Using grep and glob to find directories containing file

by BrowserUk (Pope)
on Feb 03, 2013 at 15:35 UTC ( #1016830=note: print w/ replies, xml ) Need Help??


in reply to Re^2: Using grep and glob to find directories containing file
in thread Using grep and glob to find directories containing file

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).

You are missing the fact that grep puts the glob in a scalar context, and that makes it act as an iterator:

In scalar context, glob iterates through such filename expansions, returning undef when the list is exhausted.

With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.


Comment on Re^3: Using grep and glob to find directories containing file

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1016830]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (9)
As of 2014-08-29 23:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (289 votes), past polls