I am not sure what question you are asking?

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?


In reply to Re: How to match the file and rename the contents in the .config files of directories and subdirectories using perl? by Marshall
in thread How to match the file and rename the contents in the .config files of directories and subdirectories using perl? by finddata

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.