Hello there , I have the following code:
my @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"}++;
}
}
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 well
-hi.bld
-do.bld
+one.bld
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