splitOnce has asked for the wisdom of the Perl Monks concerning the following question:
where I am trying to get all the .bld file and change the word old to new within each .bld file,, the problem I am facing is that the .bld file contains sub .bld's which I need to change as wellmy @todo = glob('d:/Profiles/sal/Desktop/testFolder/*.bld'); # some k +ind of file my %done; undef $/; while(@todo) { my $file = shift @todo; print "File Name : $file\n"; open FILE, "+<$file" or die "Can't open file $file: $!"; $_ = <FILE>; # whole contents of file if(s/\bold\b/new/g) { # replace contents of file seek FILE, 0, 0; truncate FILE, 0; print FILE; } my($dir) = $file =~ m[(.*/)]; while(/^#include (\S+);/mg) { push @todo, "$dir$1" unless $done{"$dir$1"}++; } }
with the code above I was able to get the hi.bld wich is the top level file to change however the subfiles like do.bld and one.bld don't get affacted ,, I was thinking maybe because hi.bld is not a directory but contains sunfiles under it .. I am kinda of lost ,, do you see the problem I am missing .. thanks-hi.bld -do.bld +one.bld
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: problem going through sub directories
by bart (Canon) on Aug 29, 2002 at 20:29 UTC | |
|
Re: subDIR problem
by RollyGuy (Chaplain) on Aug 29, 2002 at 19:19 UTC | |
by amoura (Initiate) on Aug 29, 2002 at 19:34 UTC | |
by bart (Canon) on Aug 29, 2002 at 23:07 UTC | |
|
Re: problem going through sub directories
by Django (Pilgrim) on Aug 29, 2002 at 19:24 UTC |