in reply to copy and rename depending on location

Sounds like you want to descend through various directory trees, looking for files with names like nnn.dat and then do something with them.

The File::Find module is designed to facilitate this. One quick search found: Beginners guide to File::Find. Take a look, try some code.

When writing code use the <code>...</code> tags, otherwise it is really hard to understand your path names.