|
|
|
Your skill will accomplish what the force of many cannot |
|
| PerlMonks |
Re: Using grep and glob to find directories containing fileby moritz (Cardinal) |
| on Feb 03, 2013 at 15:14 UTC ( #1016829=note: print w/ replies, xml ) | Need Help?? |
|
Weird, your code works for me:
Which is exactly what you seem to want. Maybe your problem is actually elsewhere? Update: I found a problem. If there's more than one match, the code skips every second dir. The reason is that glob in scalar context is stateful, and needs on extra cycle to reset. A possible fix is to evaluate the glob in list context, and check if the list has a least one element.
In Section
Seekers of Perl Wisdom
|
|