in reply to Directory operations

Assuming that you've found the file and have the directory name separate from the basename (File::Basename), I'd use a regex to replace "c:\temp" with "c:\docs" and then use mkpath from File::Path to create the target destination. Then copy the file over from one to the other. (See read_file and write_file from File::Slurp or perhaps just File::Copy.)

You may also want to consider using Path::Class for your path/filename handling and recursive searching, at it wraps useful functionality from several of the other modules I mentioned.

-xdg

Code written by xdg and posted on PerlMonks is public domain. It is provided as is with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk.