in reply to Directory Creation Routine

To create multiple directories at once, use File::Path's mkpath. Note that it dies on error, so wrap it in an eval {} and check $@ if you need to continue on error. Untested:
use File::Path "mkpath"; use File::Copy; eval { mkpath(['d:\test\dir1\dir2\dir3']); 1 } or warn "couldn't create path: $@"; copy('c:\dir1\dir2\dir3\myfile.txt', 'd:\test\dir1\dir2\dir3\myfile.txt');
If you just are given the 'c:\dir1\dir2\dir3\myfile.txt' and 'd:\test' names and need to split off and reassemble the directory name, look at File::Spec.