http://www.perlmonks.org?node_id=930294

oolmos has asked for the wisdom of the Perl Monks concerning the following question:

Dear Monks. I’m running into a fairly simple problem but I have not been able to solve it. I have decided to look for some help. I’m not very good scripting and I was hoping I would find a Samaritan on this website. I have files in the following format: /test1/da/0/1/nnn.dat /test1/da/0/2/nnn.dat /test1/da/0/3/nnn.dat … /test1/da/y/n/nnn.dat /test1/da/y+1/n+1/nnn.dat /test1/da/y+1/n+2/nnn.dat … /test1/da/y+n/n+n/nnn.dat I want to copy all nnn.dat files that are located in every subfolder into a /newfolder/nnn.dat in such a way that each nnn.dat gets renamed according to its location for example: /newfolder/0_1_nnn.dat /newfolder/0_2_nnn.dat /newfolder/0_3_nnn.dat … /newfolder/y_n_nnn.dat Also, I want to replace an specific line number of the nnn.dat file with an specific set of characters. Please HELP!