Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister

Re: Reading the same file from all the subdirectories

by GrandFather (Sage)
on Sep 06, 2012 at 05:28 UTC ( #992007=note: print w/replies, xml ) Need Help??

in reply to Reading the same file from all the subdirectories

Something like the following (untested) code perhaps?

opendir my ($scan), $path or die "Can't scan folder $path: $!\n"; while (my $entry = readdir $scan) { next if ! -d "$path/$entry" || $entry !~ /^d[1-5]$/; next if ! -f "$path/$entry/list.txt"; ... }
True laziness is hard work

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://992007]
[marioroy]: why do some posters not know to provide a good SSCCE? Nested loops?
[Corion]: marioroy: Producing good SSCCE is an acquired skill :) You have to produce bad SSCCEs for a long time until you get good. And when you get good, you don't need them that much anymore because you simply isolate the problem and then solve it ;)
[marioroy]: ... and kcott is able to provide something. Amazing.
[hippo]: kcott's analysis consistently impresses.

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (8)
As of 2017-08-18 08:19 GMT
Find Nodes?
    Voting Booth?
    Who is your favorite scientist and why?

    Results (297 votes). Check out past polls.