Your code looks like it should work, but I didn't test it myself. If I were doing this, I would use File::Find to do the recursion instead of implementing it myself. There is also an option of going "bottom up" using finddepth() which could also be considered. This would process all the plain files first (like your .config files) and then process the directory name that those files were in after processing that directories contents.
It appears to me that you have a translation table hash to provide the rules to translate blk3->test and blk1->de_top, etc in the config file (your example of DCMS_DEMO.config). Are you asking how to write that code? This task appears to be straightforward although I would highly recommend making a backup copy of the original config file as a part of the editing process so that you don't loose information in the event of a crash (which might not have anything to do with your program - stuff happens).
It looks to me like you understand the basics. Where are you stuck?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How to match the file and rename the contents in the .config files of directories and subdirectories using perl?
by finddata (Sexton) on Mar 13, 2017 at 04:05 UTC | |
|
Re^2: How to match the file and rename the contents in the .config files of directories and subdirectories using perl?
by finddata (Sexton) on Mar 13, 2017 at 04:19 UTC | |
by Marshall (Canon) on Mar 14, 2017 at 22:06 UTC |